aboutsummaryrefslogtreecommitdiff
path: root/game/characters/player/Player.gd
diff options
context:
space:
mode:
Diffstat (limited to 'game/characters/player/Player.gd')
-rw-r--r--game/characters/player/Player.gd18
1 files changed, 8 insertions, 10 deletions
diff --git a/game/characters/player/Player.gd b/game/characters/player/Player.gd
index 862a0a1..56a60d0 100644
--- a/game/characters/player/Player.gd
+++ b/game/characters/player/Player.gd
@@ -1,8 +1,6 @@
extends CharacterBody2D
-
-@export var SPEED = 300.0
-var JUMP_VELOCITY = -400.0
+const JUMP_VELOCITY = -500.0
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
@@ -14,15 +12,15 @@ func _physics_process(delta):
velocity.y += gravity * delta
# Handle Jump.
- if Input.is_action_just_pressed("jump") and is_on_floor():
+ if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
- var direction = Input.get_axis("left", "right")
- if direction:
- velocity.x = direction * SPEED
- else:
- velocity.x = move_toward(velocity.x, 0, SPEED)
-
+ velocity.x = 1 * Stats.playerspeed
move_and_slide()
+
+ if Stats.playerdead == true:
+ queue_free()
+ get_tree().paused = true
+ $"../Game Over".show()