Skip to content

Commit

Permalink
chore: Run gdformat
Browse files Browse the repository at this point in the history
  • Loading branch information
addianto committed Feb 28, 2024
1 parent 00320b4 commit a83d91f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions scenes/Player.gd
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -36,4 +39,3 @@ func _process(delta):
sprite.flip_h = true
else:
animator.play("Idle")

0 comments on commit a83d91f

Please sign in to comment.