Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody2D
- # Declare member variables here. Examples:
- # var a = 2
- # var b = "text"
- const SPEED = 200
- const GRAVITY = 100
- const JUMP = 500
- # Called when the node enters the scene tree for the first time.
- func _ready():
- pass # Replace with function body.
- func _physics_process(delta):
- var move = Vector2()
- if Input.is_action_pressed("ui_down"):
- move.y = SPEED
- if Input.is_action_pressed("ui_up"):
- move.y = -SPEED
- if Input.is_action_pressed("ui_left"):
- move.x = -SPEED
- if Input.is_action_pressed("ui_right"):
- move.x = SPEED
- if Input.is_action_pressed("ui_accept"):
- move.y -= JUMP
- move.y += 100
- move_and_slide(move)
- #
- # -------> aumenta la x
- # |
- # v aumenta la y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement