Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a new scene for each level in game #93

Merged
merged 10 commits into from
Apr 16, 2024
6 changes: 1 addition & 5 deletions Game/LifeQuest/Scripts/MapScene/Level1.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
extends Button


# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
Expand All @@ -16,10 +14,8 @@ func _on_toggled(toggled_on):
else:
$PopMenu.visible = false


func _on_yes_pressed():
get_tree().change_scene_to_file("res://game_scene.tscn")

get_tree().change_scene_to_file("res://level_one.tscn")

func _on_no_pressed():
button_pressed = false
21 changes: 21 additions & 0 deletions Game/LifeQuest/Scripts/MapScene/Level2.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends Button

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func _on_toggled(toggled_on):
if $PopMenu.visible == false:
$PopMenu.visible = true
else:
$PopMenu.visible = false

func _on_yes_pressed():
get_tree().change_scene_to_file("res://level_two.tscn")

func _on_no_pressed():
button_pressed = false
21 changes: 21 additions & 0 deletions Game/LifeQuest/Scripts/MapScene/Level3.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends Button

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func _on_toggled(toggled_on):
if $PopMenu.visible == false:
$PopMenu.visible = true
else:
$PopMenu.visible = false

func _on_yes_pressed():
get_tree().change_scene_to_file("res://level_three.tscn")

func _on_no_pressed():
button_pressed = false
File renamed without changes.
34 changes: 17 additions & 17 deletions Game/LifeQuest/game_scene.tscn → Game/LifeQuest/level_one.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[gd_scene load_steps=9 format=3 uid="uid://ccuoxmewdujb4"]

[ext_resource type="Texture2D" uid="uid://sp5sqsqilkte" path="res://Sprites/tilemap_Floor_spaced_smaller.png" id="1_khfqp"]
[ext_resource type="Script" path="res://game_scene.gd" id="1_xu6qf"]
[ext_resource type="Script" path="res://Scripts/Inventory GUI/UserInterface.gd" id="2_rva7x"]
[ext_resource type="PackedScene" uid="uid://bqwh0ar8cqyro" path="res://inventory.tscn" id="2_vgroc"]
[ext_resource type="PackedScene" uid="uid://ccwd1ftqobgn8" path="res://in_game_menu.tscn" id="6_satse"]
[ext_resource type="Script" path="res://level_one.gd" id="1_cocsj"]
[ext_resource type="Texture2D" uid="uid://sp5sqsqilkte" path="res://Sprites/tilemap_Floor_spaced_smaller.png" id="2_7ejom"]
[ext_resource type="Script" path="res://Scripts/Inventory GUI/UserInterface.gd" id="3_xq1jt"]
[ext_resource type="PackedScene" uid="uid://bqwh0ar8cqyro" path="res://inventory.tscn" id="4_kvqbx"]
[ext_resource type="PackedScene" uid="uid://ccwd1ftqobgn8" path="res://in_game_menu.tscn" id="5_o2m2h"]

[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_olttd"]
texture = ExtResource("1_khfqp")
texture = ExtResource("2_7ejom")
separation = Vector2i(6, 12)
texture_region_size = Vector2i(65, 65)
0:0/0 = 0
Expand Down Expand Up @@ -151,25 +151,25 @@ sources/0 = SubResource("TileSetAtlasSource_olttd")
script/source = "extends Button
"

[node name="GameScene" type="Node2D"]
script = ExtResource("1_xu6qf")
[node name="LevelOne" type="Node2D"]
script = ExtResource("1_cocsj")

[node name="PlaceHolder" type="Label" parent="."]
offset_left = 375.0
offset_top = 236.0
offset_right = 638.0
offset_bottom = 308.0
text = "This is the game level placeholder"
[node name="LevelTitle" type="Label" parent="."]
offset_left = 2.0
offset_top = 2.0
offset_right = 265.0
offset_bottom = 74.0
text = "LEVEL 1"

[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_b1e8q")
format = 2
layer_0/tile_data = PackedInt32Array(524288, 131072, 2, 524289, 131072, 2, 524290, 131072, 2, 524291, 131072, 2, 524292, 131072, 2, 524293, 131072, 2, 524294, 131072, 2, 524295, 131072, 2, 524296, 131072, 2, 524297, 131072, 2, 524298, 131072, 2, 524299, 131072, 2, 524300, 131072, 2, 524301, 131072, 2, 524302, 131072, 2, 524303, 131072, 2, 524304, 131072, 2, 524305, 131072, 2, 458762, 327680, 1, 393226, 327680, 1, 327690, 327680, 1, 327691, 327680, 0, 327692, 327680, 0, 327693, 327680, 0, 327694, 327680, 0, 327695, 327680, 0, 327696, 327680, 0)

[node name="UserInterface" type="CanvasLayer" parent="."]
script = ExtResource("2_rva7x")
script = ExtResource("3_xq1jt")

[node name="Inventory" parent="UserInterface" instance=ExtResource("2_vgroc")]
[node name="Inventory" parent="UserInterface" instance=ExtResource("4_kvqbx")]
visible = false

[node name="Settings" type="Button" parent="."]
Expand All @@ -181,7 +181,7 @@ toggle_mode = true
text = "Settings"
script = SubResource("GDScript_uxry2")

[node name="Menu" parent="." instance=ExtResource("6_satse")]
[node name="Menu" parent="." instance=ExtResource("5_o2m2h")]
offset_left = 1088.0
offset_top = 35.0
offset_right = 1128.0
Expand Down
19 changes: 19 additions & 0 deletions Game/LifeQuest/level_three.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends Node2D

@onready var menu = $Menu

# Called when the node enters the scene tree for the first time.
func _ready():
menu.hide() # Ensure in game menu is hidden when level starts

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func _on_settings_pressed():
if menu.visible == false: # If menu is hidden:
menu.visible = true # Show menu
Engine.time_scale = 1 # Pause game
else: # If menu is showing:
menu.visible = false # Hide menu
Engine.time_scale = 0 # Resume game
190 changes: 190 additions & 0 deletions Game/LifeQuest/level_three.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
[gd_scene load_steps=9 format=3 uid="uid://dpt2cvlskjkbq"]

[ext_resource type="Script" path="res://level_three.gd" id="1_wrmem"]
[ext_resource type="Texture2D" uid="uid://sp5sqsqilkte" path="res://Sprites/tilemap_Floor_spaced_smaller.png" id="2_27f18"]
[ext_resource type="Script" path="res://Scripts/Inventory GUI/UserInterface.gd" id="3_aabb0"]
[ext_resource type="PackedScene" uid="uid://bqwh0ar8cqyro" path="res://inventory.tscn" id="4_u6472"]
[ext_resource type="PackedScene" uid="uid://ccwd1ftqobgn8" path="res://in_game_menu.tscn" id="5_rnlue"]

[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_olttd"]
texture = ExtResource("2_27f18")
separation = Vector2i(6, 12)
texture_region_size = Vector2i(65, 65)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
8:0/0 = 0
9:0/0 = 0
10:0/0 = 0
11:0/0 = 0
0:1/0 = 0
1:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
8:1/0 = 0
9:1/0 = 0
10:1/0 = 0
11:1/0 = 0
0:2/0 = 0
1:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
8:2/0 = 0
9:2/0 = 0
10:2/0 = 0
11:2/0 = 0
0:3/0 = 0
1:3/0 = 0
2:3/0 = 0
3:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
8:3/0 = 0
9:3/0 = 0
10:3/0 = 0
11:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
8:4/0 = 0
9:4/0 = 0
10:4/0 = 0
11:4/0 = 0
0:5/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
8:5/0 = 0
9:5/0 = 0
10:5/0 = 0
11:5/0 = 0
0:6/0 = 0
1:6/0 = 0
2:6/0 = 0
3:6/0 = 0
4:6/0 = 0
5:6/0 = 0
6:6/0 = 0
7:6/0 = 0
8:6/0 = 0
9:6/0 = 0
10:6/0 = 0
11:6/0 = 0
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
8:7/0 = 0
9:7/0 = 0
10:7/0 = 0
11:7/0 = 0
0:8/0 = 0
1:8/0 = 0
2:8/0 = 0
3:8/0 = 0
4:8/0 = 0
5:8/0 = 0
6:8/0 = 0
7:8/0 = 0
8:8/0 = 0
9:8/0 = 0
10:8/0 = 0
11:8/0 = 0
0:9/0 = 0
1:9/0 = 0
2:9/0 = 0
3:9/0 = 0
4:9/0 = 0
5:9/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
0:10/0 = 0
1:10/0 = 0
2:10/0 = 0
3:10/0 = 0
4:10/0 = 0
5:10/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
2:1/0 = 0
2:2/0 = 0

[sub_resource type="TileSet" id="TileSet_b1e8q"]
tile_size = Vector2i(64, 65)
sources/0 = SubResource("TileSetAtlasSource_olttd")

[sub_resource type="GDScript" id="GDScript_uxry2"]
script/source = "extends Button
"

[node name="LevelThree" type="Node2D"]
script = ExtResource("1_wrmem")

[node name="LevelTitle" type="Label" parent="."]
offset_left = 1.0
offset_top = 1.0
offset_right = 264.0
offset_bottom = 73.0
text = "LEVEL 3"

[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_b1e8q")
format = 2
layer_0/tile_data = PackedInt32Array(524288, 131072, 2, 524289, 131072, 2, 524290, 131072, 2, 524291, 131072, 2, 524292, 131072, 2, 524293, 131072, 2, 524294, 131072, 2, 524295, 131072, 2, 524296, 131072, 2, 524297, 131072, 2, 524298, 131072, 2, 524299, 131072, 2, 524300, 131072, 2, 524301, 131072, 2, 524302, 131072, 2, 524303, 131072, 2, 524304, 131072, 2, 524305, 131072, 2, 458762, 327680, 1, 393226, 327680, 1, 327690, 327680, 1, 327691, 327680, 0, 327692, 327680, 0, 327693, 327680, 0, 327694, 327680, 0, 327695, 327680, 0, 327696, 327680, 0)

[node name="UserInterface" type="CanvasLayer" parent="."]
script = ExtResource("3_aabb0")

[node name="Inventory" parent="UserInterface" instance=ExtResource("4_u6472")]
visible = false

[node name="Settings" type="Button" parent="."]
offset_left = 1082.0
offset_top = 1.0
offset_right = 1152.0
offset_bottom = 32.0
toggle_mode = true
text = "Settings"
script = SubResource("GDScript_uxry2")

[node name="Menu" parent="." instance=ExtResource("5_rnlue")]
offset_left = 1088.0
offset_top = 35.0
offset_right = 1128.0
offset_bottom = 71.0

[connection signal="pressed" from="Settings" to="." method="_on_settings_pressed"]
19 changes: 19 additions & 0 deletions Game/LifeQuest/level_two.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends Node2D

@onready var menu = $Menu

# Called when the node enters the scene tree for the first time.
func _ready():
menu.hide() # Ensure in game menu is hidden when level starts

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func _on_settings_pressed():
if menu.visible == false: # If menu is hidden:
menu.visible = true # Show menu
Engine.time_scale = 1 # Pause game
else: # If menu is showing:
menu.visible = false # Hide menu
Engine.time_scale = 0 # Resume game
Loading
Loading