Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | srinivas |
** I cannot move the character from A to B in the path as shown in the image, it directly slides from A to B instead. what changes should I made if the image should follow the same path as shown in the image.Below is the code I have written,Please correct my code**
extends AnimatedSprite
var Char_speed = 1
var At_A = false
var At_B = false
var At_C = false
onready var p = get_parent()
func _ready():
pass # Replace with function body.
func _process(delta):
if not At_A and position.x < p.get_node("Point A").position.x:
position.x += Char_speed
if not At_B and position.y < p.get_node("Point B").position.y:
position.y += Char_speed
if not At_C and position.x < p.get_node("Point C").position.x:
position.x += Char_speed
See the Image for better Understanding
There is no image, and the code snippet doesn’t help understanding your question. Could you provide some more details, please?
Thomas Karcher | 2020-11-29 11:15
Hi Srinivas,
are you just trying to animate the character along that path without any player control? Like a movie?
If yes, maybe you can simplify things by using a Path2D - that is Godot’s built in mechanism for following paths. Docs are here
There is a nice recipe here which shows you how to make it work
(By the way, I love the look of the graphics)
AndyCampbell | 2020-11-29 16:58
Thanks a lot for responding immediately.
srinivas | 2020-11-29 20:30