mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
4.0: Convert Sprite references to Sprite2D
Some screenshots will need to be updated so that the scene structures shown in screenshot fit what the code blocks are referring to.
This commit is contained in:
@@ -43,7 +43,7 @@ Here is example pseudo-code for going from point A to B using interpolation:
|
||||
func _physics_process(delta):
|
||||
t += delta * 0.4
|
||||
|
||||
$Sprite.position = $A.position.linear_interpolate($B.position, t)
|
||||
$Sprite2D.position = $A.position.linear_interpolate($B.position, t)
|
||||
|
||||
It will produce the following motion:
|
||||
|
||||
@@ -89,7 +89,7 @@ Interpolation can be used to smooth movement, rotation, etc. Here is an example
|
||||
func _physics_process(delta):
|
||||
var mouse_pos = get_local_mouse_position()
|
||||
|
||||
$Sprite.position = $Sprite.position.linear_interpolate(mouse_pos, delta * FOLLOW_SPEED)
|
||||
$Sprite2D.position = $Sprite2D.position.linear_interpolate(mouse_pos, delta * FOLLOW_SPEED)
|
||||
|
||||
Here is how it looks:
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ Putting it all together
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We're going to apply everything we mentioned so far onto one transform.
|
||||
To follow along, create a project with a Sprite node and use the
|
||||
To follow along, create a project with a Sprite2D node and use the
|
||||
Godot logo for the texture resource.
|
||||
|
||||
Let's set the translation to (350, 150), rotate by -0.5 rad, and scale by 3.
|
||||
|
||||
Reference in New Issue
Block a user