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:
Rémi Verschelde
2021-10-06 14:29:55 +02:00
parent 15f78ae0b9
commit 9a05eef561
37 changed files with 243 additions and 243 deletions

View File

@@ -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:

View File

@@ -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.