Created
July 13, 2022 13:46
-
-
Save pdaug/1aec0cba1e2b07fdd90c55a13d798ffc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody2D | |
var velocidade = 200 | |
var pulo = 500 | |
var gravidade = 20 | |
var movimento = Vector2() | |
func _physics_process(_delta): | |
movimento.y += gravidade | |
if Input.is_action_pressed("ui_left"): | |
movimento.x = -velocidade | |
elif Input.is_action_pressed("ui_right"): | |
movimento.x = velocidade | |
else: | |
movimento.x = 0 | |
if Input.is_action_just_pressed("ui_up") and is_on_floor(): | |
movimento.y = -pulo | |
movimento = move_and_slide(movimento, Vector2.UP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment