This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm trying to get the ghost animation to change when he follows a path but the position returned is always (0,0) or the rotation is always 0. Its an isometric map.

Does anyone have ideas or can tell me how they do it.

the code I'm tying to use is

extends KinematicBody2D

var direction = Vector2()
var currentdirection = Vector2(0,0)

# Called when the node enters the scene tree for the first time.
func _ready():

func _physics_process(delta):
    var dir = position
    var direction = dir.normalized()

    # Moves Ghost
    get_parent().set_offset(get_parent().get_offset() + 250 * delta)

func ghost_anim(direction):
    var spritedir
    if currentdirection != direction:
        if currentdirection == Vector2(-1,-1):
            spritedir = "Back_Left"
        elif currentdirection == Vector2(1,-1):
            spritedir = "Back_Right"  
        elif direction == Vector2(-1,1):  
            spritedir = "Front_Left"
        elif direction == Vector2(1,1):  
            spritedir = "Front_Right"
        spritedir = "Front_Left"


    currentdirection = direction
    return currentdirection
in Engine by (31 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.