Game over/ Pause screen

cerated a functional game over screen. created a partially working pause screen.
This commit is contained in:
sam committed 2026-10-04 12:58:17 -06:00
1 parent d50bcf3850
commit 37b5ba6a8f
17 files changed
+508 -80

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ const PhoneSounds = [
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GloblaData.level += 1
GloblaData.level2 += 1
var origin = Vector2(150, 225)
var offset = Vector2(135, 120)
$Button0.position.y = origin.y + 3 * offset.y + 3 * -10
+55 -30
View File
@@ -117,7 +117,7 @@ var slash = 300
@export var roll: bool
var projectile = preload("res://scenes/projectile.tscn")
signal dead
#Variables determined by the developer set ones.
var appliedGravity: float
var maxSpeedLock: float
@@ -324,6 +324,7 @@ func _process(_delta):
var dir: bool = 1
func _physics_process(delta):
print(GloblaData.death_counter)
if Input.is_action_just_pressed("slash_weapon"):
weapon = 1
GloblaData.weapon = 1
@@ -339,6 +340,11 @@ func _physics_process(delta):
$ColorRect5.rotation = -130
dir = 0
if GloblaData.doing_puzzle == false:
if Input.is_action_just_pressed("pause"):
toggle_paused()
if Input.is_action_just_pressed("right"):
$ColorRect5.global_position = $Marker2D3.global_position
$ColorRect5.rotation = 130
@@ -362,12 +368,16 @@ func _physics_process(delta):
if GloblaData.doing_puzzle:
velocity = Vector2(0, 0)
if GloblaData.death_counter == 0:
get_tree().quit()
if GloblaData.death_counter <= 0:
$AnimatedSprite2D.play("death")
emit_signal("dead")
dead.disconnect(_on_dead)
if GloblaData.death_counter == 2:
$ColorRect3.hide()
elif GloblaData.death_counter == 1:
$ColorRect4.hide()
elif GloblaData.death_counter == 0:
$ColorRect2.hide()
if !dset:
gdelta = delta
dset = true
@@ -394,34 +404,34 @@ func _physics_process(delta):
if weapon == 1:
anim_preamble = "sword_"
if !is_on_floor():
$AnimatedSprite2D.animation = "%sjump" % anim_preamble
$AnimatedSprite2D.play()
elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 2:
$AnimatedSprite2D.animation = "run_shoot"
$AnimatedSprite2D.play()
elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 1:
$AnimatedSprite2D.animation = "sword_run_swing"
$AnimatedSprite2D.play()
elif leftHold or rightHold:
$AnimatedSprite2D.animation = "%srun" % anim_preamble
$AnimatedSprite2D.play()
elif runHold:
$AnimatedSprite2D.animation = "%srun" % anim_preamble
$AnimatedSprite2D.play()
elif Input.is_action_just_pressed("fire") and weapon == 2:
$AnimatedSprite2D.animation = "shoot"
$AnimatedSprite2D.play()
elif Input.is_action_just_pressed("fire") and weapon == 1:
$AnimatedSprite2D.animation = "sword_swing"
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.animation = "%sidle" % anim_preamble
$AnimatedSprite2D.play()
if GloblaData.death_counter > 0:
if !is_on_floor():
$AnimatedSprite2D.animation = "%sjump" % anim_preamble
$AnimatedSprite2D.play()
elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 2:
$AnimatedSprite2D.animation = "run_shoot"
$AnimatedSprite2D.play()
elif (leftHold or rightHold) and Input.is_action_just_pressed("fire") and weapon == 1:
$AnimatedSprite2D.animation = "sword_run_swing"
$AnimatedSprite2D.play()
elif leftHold or rightHold:
$AnimatedSprite2D.animation = "%srun" % anim_preamble
$AnimatedSprite2D.play()
elif runHold:
$AnimatedSprite2D.animation = "%srun" % anim_preamble
$AnimatedSprite2D.play()
elif Input.is_action_just_pressed("fire") and weapon == 2:
$AnimatedSprite2D.animation = "shoot"
$AnimatedSprite2D.play()
elif Input.is_action_just_pressed("fire") and weapon == 1:
$AnimatedSprite2D.animation = "sword_swing"
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.animation = "%sidle" % anim_preamble
$AnimatedSprite2D.play()
#INFO Left and Right Movement
if GloblaData.doing_puzzle == false:
if GloblaData.doing_puzzle == false and GloblaData.death_counter > 0:
if rightHold and leftHold and movementInputMonitoring:
if !instantStop:
_decelerate(delta, false)
@@ -509,7 +519,7 @@ func _physics_process(delta):
pass
#INFO Jump and Gravity
if GloblaData.doing_puzzle == false:
if GloblaData.doing_puzzle == false and GloblaData.death_counter > 0:
if velocity.y > 0:
appliedGravity = gravityScale * descendingGravityFactor
else:
@@ -756,3 +766,18 @@ func shoot():
func _on_timer_timeout() -> void:
GloblaData.hurtable = false
func _on_dead() -> void:
var death_scene = preload("res://scenes/game_over.tscn")
var instance = death_scene.instantiate()
$".".add_child(instance)
func toggle_paused():
var pause = preload("res://scenes/pause_screen.tscn")
var instace = pause.instantiate()
$"..".add_child(instace)
instace.position = $"..".global_position
get_tree().paused = true