0 votes

I don't have any knowledge on doing so, can someone point me in the right direction?

Nothing in my scene has collisions (yet)

extends KinematicBody2D

#const GRAVITY = 200.0
const WALK_SPEED = 200

var velocity = Vector2()

func _fixed_process(delta):

    velocity.x += delta #* GRAVITY
    velocity.y += delta #* GRAVITY

    if (Input.is_action_pressed("ui_left")):
        velocity.x = -WALK_SPEED
    elif (Input.is_action_pressed("ui_right")):
        velocity.x =  WALK_SPEED
    elif (Input.is_action_pressed("ui_down")):
        velocity.y = WALK_SPEED
    elif (Input.is_action_pressed("ui_up")):
        velocity.y = -WALK_SPEED
        velocity.x = 0
        velocity.y = 0

    var motion = velocity * delta

func _ready():
in Engine by (163 points)
edited by

Please format your code properly.

1 Answer

0 votes

It can have many non-visible sprites as children of the body and turn them on and off when collisions or other things happens, or change the frame if is a spritesheet.

Since you are working with a kinematic body, remember that these are collision-aware when moving with move only, otherwise are regular kinematics (ignoring everything).

If you want passive detection, it may need some extra help, like using areas.

by (7,908 points)
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.