Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends CharacterBody2D
- var speed = 300
- func _physics_process(delta):
- # Resets velocity
- velocity = Vector2()
- # These inputs will need to be created in the input map
- if Input.is_action_pressed("left"):
- velocity.x -= 1
- if Input.is_action_pressed("right"):
- velocity.x += 1
- if Input.is_action_pressed("up"):
- velocity.y -= 1
- if Input.is_action_pressed("down"):
- velocity.y += 1
- velocity = velocity * speed
- move_and_slide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement