Game over/ Pause screen

cerated a functional game over screen. created a partially working pause screen.
This commit is contained in:
sam authored and bigmstone committed 2026-10-04 13:04:20 -06:00
1 parent 4fab177813
commit 6c6bc2a21a
15 files changed
+507 -50

No files matched your search

+55 -30
View File
@@ -119,7 +119,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
@@ -326,6 +326,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
@@ -341,6 +342,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
@@ -364,12 +370,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
@@ -396,34 +406,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)
@@ -511,7 +521,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:
@@ -758,3 +768,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