From a4f737b2be0409a48d00c0d20bb6f7b21852d345 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 25 Jun 2023 15:43:55 -0400 Subject: Death implemented, added money spent, pause screen --- game/characters/player/Player.gd | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'game/characters/player/Player.gd') 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() -- cgit v1.2.3