Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | HarryCourt | |
Old Version | Published before Godot 3 was released. |
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
else:
velocity.x = 0
velocity.y = 0
var motion = velocity * delta
move(motion)
func _ready():
set_fixed_process(true)
Please format your code properly.
timoschwarzer | 2017-07-23 09:31