From 61912a7df4ed1eff8b567d3e229403565b7f21a0 Mon Sep 17 00:00:00 2001 From: sstone Date: Sat, 3 Oct 2026 21:55:39 -0600 Subject: [PATCH] Changing levels I made it where if you beat phonephreak it moves you to the next level. --- Globla_Data.gd | 1 + scenes/level_2.gd | 11 +++++++++++ scenes/level_2.gd.uid | 1 + scenes/level_2.tscn | 26 +++++++++++++++++++++++++ scenes/levels/level_1.gd | 3 ++- scenes/puzzles/phonephreak.tscn | 12 +++++++++++- scenes/title.gd | 15 ++++++++++++++ scenes/title.gd.uid | 1 + scenes/title.tscn | 24 +++++++++++++---------- scripts/Phonephreak.gd | 7 ++++--- scripts/UltimatePlatformerController.gd | 20 +++++++++---------- 11 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 scenes/level_2.gd create mode 100644 scenes/level_2.gd.uid create mode 100644 scenes/level_2.tscn create mode 100644 scenes/title.gd create mode 100644 scenes/title.gd.uid diff --git a/Globla_Data.gd b/Globla_Data.gd index 45f9a38..bf6f45c 100644 --- a/Globla_Data.gd +++ b/Globla_Data.gd @@ -9,3 +9,4 @@ var cassets = 0 var doing_puzzle: bool = false var hurtable = false var weapon = 1 +var level = 1 diff --git a/scenes/level_2.gd b/scenes/level_2.gd new file mode 100644 index 0000000..52c046e --- /dev/null +++ b/scenes/level_2.gd @@ -0,0 +1,11 @@ +extends Node2D + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + GloblaData.doing_puzzle = false diff --git a/scenes/level_2.gd.uid b/scenes/level_2.gd.uid new file mode 100644 index 0000000..c35d729 --- /dev/null +++ b/scenes/level_2.gd.uid @@ -0,0 +1 @@ +uid://c0kr0eqjtde28 diff --git a/scenes/level_2.tscn b/scenes/level_2.tscn new file mode 100644 index 0000000..f8b75a5 --- /dev/null +++ b/scenes/level_2.tscn @@ -0,0 +1,26 @@ +[gd_scene format=3 uid="uid://b6tcpqx0h3qpy"] + +[ext_resource type="PackedScene" uid="uid://cmtdq6tedv1mm" path="res://scenes/player.tscn" id="1_3bmlt"] +[ext_resource type="Script" uid="uid://c0kr0eqjtde28" path="res://scenes/level_2.gd" id="1_jm1iu"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"] +size = Vector2(2007, 149) + +[node name="level2" type="Node2D" unique_id=1987596250] +script = ExtResource("1_jm1iu") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=426446834] +offset_left = 8.0 +offset_top = 865.0 +offset_right = 2003.0 +offset_bottom = 989.0 + +[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=471962104] +collision_layer = 2 +collision_mask = 5 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1096663356] +position = Vector2(1010, 942) +shape = SubResource("RectangleShape2D_aqe1g") + +[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_3bmlt")] diff --git a/scenes/levels/level_1.gd b/scenes/levels/level_1.gd index d526a2c..7eb8b5d 100644 --- a/scenes/levels/level_1.gd +++ b/scenes/levels/level_1.gd @@ -6,7 +6,8 @@ extends Node2D # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - pass + if GloblaData.doing_puzzle == true: + $player.global_position = $Marker2D2.global_position func _on_area_2d_body_entered(body: Node2D) -> void: diff --git a/scenes/puzzles/phonephreak.tscn b/scenes/puzzles/phonephreak.tscn index 6377a10..41f6e07 100644 --- a/scenes/puzzles/phonephreak.tscn +++ b/scenes/puzzles/phonephreak.tscn @@ -3,9 +3,9 @@ [ext_resource type="Script" uid="uid://c7fhd1eqlgwr4" path="res://scripts/Phonephreak.gd" id="1_knn0u"] [ext_resource type="FontFile" uid="uid://dkytywan8eapf" path="res://assets/fonts/PixelOperator8.ttf" id="2_bg4gc"] [ext_resource type="Texture2D" uid="uid://hbkkhhlechol" path="res://assets/sprites/phonephreak.png" id="3_ba2os"] +[ext_resource type="FontFile" uid="uid://ddm6ojsaiq20b" path="res://assets/fonts/PixelOperator8-Bold.ttf" id="4_35g6u"] [node name="Phonephreak" type="Node2D" unique_id=1830177910] -position = Vector2(0, 1) script = ExtResource("1_knn0u") [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." unique_id=519900134] @@ -40,3 +40,13 @@ offset_right = 49.0 offset_bottom = 50.0 mouse_filter = 2 color = Color(1, 1, 1, 0) + +[node name="Label" type="Label" parent="." unique_id=1513678322] +visible = false +offset_left = 18.0 +offset_top = 298.0 +offset_right = 606.0 +offset_bottom = 399.0 +theme_override_fonts/font = ExtResource("4_35g6u") +theme_override_font_sizes/font_size = 100 +text = "WRONG!" diff --git a/scenes/title.gd b/scenes/title.gd new file mode 100644 index 0000000..e147775 --- /dev/null +++ b/scenes/title.gd @@ -0,0 +1,15 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_button_pressed() -> void: + get_tree().change_scene_to_file("res://scenes/levels/level%s.tscn" % GloblaData.level) diff --git a/scenes/title.gd.uid b/scenes/title.gd.uid new file mode 100644 index 0000000..cc1fb14 --- /dev/null +++ b/scenes/title.gd.uid @@ -0,0 +1 @@ +uid://dcbdrv8y15dtu diff --git a/scenes/title.tscn b/scenes/title.tscn index 0f5ed8c..9c80cab 100644 --- a/scenes/title.tscn +++ b/scenes/title.tscn @@ -1,6 +1,7 @@ [gd_scene format=3 uid="uid://btktv5aqpafau"] [ext_resource type="FontFile" uid="uid://dkytywan8eapf" path="res://assets/fonts/PixelOperator8.ttf" id="1_4ignj"] +[ext_resource type="Script" uid="uid://dcbdrv8y15dtu" path="res://scenes/title.gd" id="1_wosw1"] [node name="Title" type="Control" unique_id=715100706] layout_mode = 3 @@ -9,29 +10,32 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_wosw1") [node name="ColorRect" type="ColorRect" parent="." unique_id=1504521213] layout_mode = 0 -offset_right = 1152.0 -offset_bottom = 648.0 +offset_right = 2013.0 +offset_bottom = 1007.0 color = Color(0, 0, 0, 1) [node name="Label" type="Label" parent="." unique_id=1433094765] layout_mode = 0 -offset_left = 107.0 -offset_top = 50.0 -offset_right = 1013.0 -offset_bottom = 301.0 +offset_left = 491.0 +offset_top = 83.0 +offset_right = 1397.0 +offset_bottom = 334.0 theme_override_fonts/font = ExtResource("1_4ignj") theme_override_font_sizes/font_size = 250 text = "title" [node name="Button" type="Button" parent="." unique_id=963162220] layout_mode = 0 -offset_left = 149.0 -offset_top = 375.0 -offset_right = 982.0 -offset_bottom = 583.0 +offset_left = 556.0 +offset_top = 536.0 +offset_right = 1389.0 +offset_bottom = 744.0 theme_override_fonts/font = ExtResource("1_4ignj") theme_override_font_sizes/font_size = 150 text = "start" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/scripts/Phonephreak.gd b/scripts/Phonephreak.gd index 241fd0a..81824cd 100644 --- a/scripts/Phonephreak.gd +++ b/scripts/Phonephreak.gd @@ -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()) diff --git a/scripts/UltimatePlatformerController.gd b/scripts/UltimatePlatformerController.gd index 035ea8a..b53ea70 100644 --- a/scripts/UltimatePlatformerController.gd +++ b/scripts/UltimatePlatformerController.gd @@ -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 -- 2.54.0