1
Fork 0
mirror of https://github.com/Steffo99/watermelonkeys-patched-ld51.git synced 2024-11-25 09:24:24 +00:00
fading-sun/Giovanna.gd

31 lines
721 B
GDScript3
Raw Normal View History

2022-10-03 13:05:31 +00:00
extends KinematicBody2D
var ammo = 6
var velocity = Vector2(0,0)
const max_speed = 150
const GRAVITY = 30
const JUMPFORCE = -500
func _physics_process(delta):
if Input.is_action_pressed("right"):
velocity.x = max_speed
$AnimatedSprite.play("walk")
$AnimatedSprite.flip_h = true
elif Input.is_action_pressed("left"):
velocity.x = -max_speed
$AnimatedSprite.play("walk")
$AnimatedSprite.flip_h = false
else:
$AnimatedSprite.play("idle")
if not is_on_floor():
$AnimatedSprite.play("air")
velocity.y = velocity.y + GRAVITY
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMPFORCE
velocity = move_and_slide(velocity,Vector2.UP)
velocity.x = lerp(velocity.x,0,0.2)