diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2023-06-25 15:43:55 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2023-06-25 15:43:55 -0400 |
| commit | a4f737b2be0409a48d00c0d20bb6f7b21852d345 (patch) | |
| tree | 13dc0c57b26e0fa78aace5575552dca0f116fce3 /game/characters/player/Player.gd | |
| parent | dbb42c99e07320bc20d77cdbe404a8071c0a522e (diff) | |
| download | frivolous-run-master.tar.gz frivolous-run-master.tar.bz2 frivolous-run-master.zip | |
Diffstat (limited to 'game/characters/player/Player.gd')
| -rw-r--r-- | game/characters/player/Player.gd | 18 |
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() |
