Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody2D
- # member variables here, example:
- # var a=2
- # var b="textvar"
- const GRAVITY = 200.0
- const WALK_SPEED = 50
- var velocity = Vector2()
- func _fixed_process(delta):
- if Input.is_action_pressed("ui_up"):
- velocity.y = -WALK_SPEED
- elif Input.is_action_pressed("ui_down"):
- velocity.y = WALK_SPEED
- elif Input.is_action_pressed("ui_left"):
- velocity.x = -WALK_SPEED
- elif Input.is_action_pressed("ui_right"):
- velocity.x = WALK_SPEED
- else:
- velocity.x = 0
- velocity.y = 0
- var motion = velocity * delta
- move( motion )
- var col = get_collider()
- if is_colliding():
- print(col)
- func _ready():
- set_fixed_process(true)
- # Initialization here
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement