From a83d91f93ee1d37cc641084efe4e5953dbc4e751 Mon Sep 17 00:00:00 2001 From: Daya Adianto Date: Wed, 28 Feb 2024 12:21:08 +0700 Subject: [PATCH] chore: Run gdformat --- scenes/Player.gd | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scenes/Player.gd b/scenes/Player.gd index 6c47e65..b0d9637 100644 --- a/scenes/Player.gd +++ b/scenes/Player.gd @@ -1,30 +1,33 @@ extends KinematicBody2D -export (int) var speed = 400 -export (int) var GRAVITY = 1200 -export (int) var jump_speed = -400 +export(int) var speed = 400 +export(int) var GRAVITY = 1200 +export(int) var jump_speed = -400 -const UP = Vector2(0,-1) +const UP = Vector2(0, -1) var velocity = Vector2() onready var animator = self.get_node("Animator") onready var sprite = self.get_node("Sprite") + func get_input(): velocity.x = 0 - if is_on_floor() and Input.is_action_just_pressed('jump'): + if is_on_floor() and Input.is_action_just_pressed("jump"): velocity.y = jump_speed - if Input.is_action_pressed('right'): + if Input.is_action_pressed("right"): velocity.x += speed - if Input.is_action_pressed('left'): + if Input.is_action_pressed("left"): velocity.x -= speed + func _physics_process(delta): velocity.y += delta * GRAVITY get_input() velocity = move_and_slide(velocity, UP) + func _process(delta): if velocity.y != 0: animator.play("Jump") @@ -36,4 +39,3 @@ func _process(delta): sprite.flip_h = true else: animator.play("Idle") -