Changing levels

I made it where if you beat phonephreak it moves you to the next level.
This commit is contained in:
sam committed 2026-10-03 21:55:39 -06:00
1 parent 7ffc756b36
commit 61912a7df4
11 files changed
+95 -26

No files matched your search

+4 -3
View File
@@ -22,6 +22,7 @@ const PhoneSounds = [
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GloblaData.level += 1
var origin = Vector2(150, 225)
var offset = Vector2(135, 120)
$Button0.position.y = origin.y + 3 * offset.y + 3 * -10
@@ -40,7 +41,7 @@ func _ready() -> void:
b.position.x = origin.x + row * offset.x + col+1 * -5
b.pressed.connect(_on_button_pressed.bind(i+1))
buttons.append(b)
b.name = "Button%i" %(i)
b.name = "Button%s" %(i)
add_child(b)
$Button0.pressed.connect(_on_button_pressed.bind(0))
@@ -53,9 +54,9 @@ func _ready() -> void:
func _process(delta: float) -> void:
if guessed.size() >= pieces.size():
if guessed == pieces:
print("Got it")
get_tree().change_scene_to_file("res://scenes/level_%s.tscn" % GloblaData.level)
else:
print("Nope")
_ready()
if !$AudioStreamPlayer2D.playing and !to_play.is_empty():
actuate_button(to_play.pop_front())
+9 -11
View File
@@ -330,24 +330,22 @@ func _physics_process(delta):
if Input.is_action_just_pressed("gun"):
weapon = 2
GloblaData.weapon = 2
if GloblaData.doing_puzzle == true:
$".".global_position = $"../Marker2D2".global_position
$Label.text = str(int(GloblaData.cassets))
if Input.is_action_just_pressed("right"):
dir = 1
$ColorRect5.global_position = $Marker2D3.global_position
$ColorRect5.rotation = 130
if Input.is_action_just_pressed("left"):
$ColorRect5.global_position = $Marker2D2.global_position
$ColorRect5.rotation = -130
dir = 0
if GloblaData.doing_puzzle == false:
if Input.is_action_just_pressed("right"):
$ColorRect5.global_position = $Marker2D3.global_position
$ColorRect5.rotation = 130
dir = 1
if Input.is_action_just_pressed("left"):
$ColorRect5.global_position = $Marker2D2.global_position
$ColorRect5.rotation = -130
dir = 0
if Input.is_action_just_pressed("fire") and weapon == 2:
var instance = projectile.instantiate()
if !dir:
instance.speed = -instance.speed
instance.position = $Marker2D.global_position
GloblaData.level_1.add_child(instance)
$"..".add_child(instance)
elif Input.is_action_just_pressed("fire") and weapon == 1:
$ColorRect5.rotation -= slash
slash = -slash