Added more interesting platforms

This commit is contained in:
Martin Felis
2024-01-27 17:06:32 +01:00
parent 993c69ea0a
commit 9c4dfcd657
17 changed files with 925 additions and 664 deletions
+15 -2
View File
@@ -17,8 +17,15 @@ class_name Player extends CharacterBody3D
signal bomb_triggered
enum PlayerState {
Alive = 0,
Falling,
Dead
}
var score : int = 0
var energy : float = 1.0
var state : PlayerState = PlayerState.Alive
var radius = 0.15
var angle = 0
@@ -48,7 +55,13 @@ func _ready():
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
if not is_dashing:
velocity.y -= gravity * delta
state = PlayerState.Falling
elif state != PlayerState.Dead:
state = PlayerState.Alive
coloring_sprite.visible = state == PlayerState.Alive
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
@@ -60,7 +73,7 @@ func _physics_process(delta):
coloring_bomb_sprite.visible = false
bomb_time = 0
else:
if Input.is_action_just_pressed(bomb_action):
if Input.is_action_just_pressed(bomb_action) and state == PlayerState.Alive:
coloring_bomb_sprite.visible = true;
bomb_time = BOMB_DURATION