From e9fe958fc294a72d4262889541233f1ba4c7ae65 Mon Sep 17 00:00:00 2001 From: Cookie <58516648+Cookie-CHR@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:46:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Main=20code=20(without=20g?= =?UTF-8?q?raphics=20and=20music?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Components/Background.gd | 19 ++++ Components/base.gd | 75 +++++++++++++ Components/dictionary.gd | 101 +++++++++++++++++ Components/gameplay.tscn | 47 ++++++++ Components/gather_info.gd | 24 ++++ Components/general_scene_changer.gd | 42 +++++++ Components/higlight_cell.gd | 136 +++++++++++++++++++++++ Components/level_completed.tscn | 47 ++++++++ Components/level_fail.tscn | 50 +++++++++ Components/level_manager.gd | 27 +++++ Components/manage_win_lose.gd | 54 +++++++++ Components/planet.tscn | 18 +++ Components/planet_spawner.gd | 32 ++++++ Components/spawner.tscn | 11 ++ Components/sprite__variations.gd | 12 ++ Components/sprite_follow_mouse.gd | 11 ++ Components/sprite_snap.gd | 21 ++++ change_level.gd | 14 +++ icon.svg | 1 + scenes/credits.tscn | 97 ++++++++++++++++ scenes/level.tscn | 12 ++ scenes/level_inner.tscn | 90 +++++++++++++++ scenes/manage_win_lose.gd | 15 +++ scenes/map.tscn | 165 ++++++++++++++++++++++++++++ scenes/menu.tscn | 121 ++++++++++++++++++++ scenes/victory.tscn | 77 +++++++++++++ 26 files changed, 1319 insertions(+) create mode 100644 Components/Background.gd create mode 100644 Components/base.gd create mode 100644 Components/dictionary.gd create mode 100644 Components/gameplay.tscn create mode 100644 Components/gather_info.gd create mode 100644 Components/general_scene_changer.gd create mode 100644 Components/higlight_cell.gd create mode 100644 Components/level_completed.tscn create mode 100644 Components/level_fail.tscn create mode 100644 Components/level_manager.gd create mode 100644 Components/manage_win_lose.gd create mode 100644 Components/planet.tscn create mode 100644 Components/planet_spawner.gd create mode 100644 Components/spawner.tscn create mode 100644 Components/sprite__variations.gd create mode 100644 Components/sprite_follow_mouse.gd create mode 100644 Components/sprite_snap.gd create mode 100644 change_level.gd create mode 100644 icon.svg create mode 100644 scenes/credits.tscn create mode 100644 scenes/level.tscn create mode 100644 scenes/level_inner.tscn create mode 100644 scenes/manage_win_lose.gd create mode 100644 scenes/map.tscn create mode 100644 scenes/menu.tscn create mode 100644 scenes/victory.tscn diff --git a/Components/Background.gd b/Components/Background.gd new file mode 100644 index 0000000..9b06c9d --- /dev/null +++ b/Components/Background.gd @@ -0,0 +1,19 @@ +extends TileMap + +var rng =RandomNumberGenerator.new() + +func _ready(): + #randomize background + rng.randomize() + + for x in range(0, 16): + for y in range(0, 10): + set_cell(0, Vector2(x,y), 0, Vector2(rng.randi_range(0,3), rng.randi_range(0,3))) + + +func _process(_delta): + #change one tile from time to time, randomly + for x in range(0, 16): + for y in range(0, 10): + if(rng.randi_range(0,200)==0): + set_cell(0, Vector2(x,y), 0, Vector2(rng.randi_range(0,3), rng.randi_range(0,3))) diff --git a/Components/base.gd b/Components/base.gd new file mode 100644 index 0000000..e89df8e --- /dev/null +++ b/Components/base.gd @@ -0,0 +1,75 @@ +extends Node2D + +var curr_player = null +var player_array = {} +@export var planets = { + "rock": 0, + "sun": 0, + "ice": 0, + "grass": 0, + "black": 0 +} +@export var map = [ + ["O", "-", "-", "-", "O"], +] +var total_moves = 0 + +signal game_success +signal game_fail + +func _ready(): + var i = 0 + for p in planets: + if(planets[p]>0): + var spawner_packed = load("res://Components/spawner.tscn") + var spawner = spawner_packed.instantiate() + spawner.type = p + spawner.charges = planets[p] + spawner.name = "spawner_"+p + spawner.position = Vector2(290+120*i, 550) + add_child(spawner) + i+=1 + total_moves += planets[p] + + $TileMap.draw_map(map) + + +func _input(_event): + if Input.is_action_just_pressed("click"): + if curr_player != null: + var success = $TileMap.check_success(get_global_mouse_position(), player_array) + if(!success): + emit_signal("game_fail") + return + var complete = $TileMap.occupy_slot(get_global_mouse_position(), player_array) + if (complete): + AudioPlayer._play("drop") + delete_player() + total_moves -= 1 + if (total_moves == 0): + emit_signal("game_success") + +func delete_player(): + curr_player.queue_free() + curr_player = null + player_array = {} + +func new_player(type): + var curr_packed = load("res://Components/planet.tscn") + var curr = curr_packed.instantiate() + curr.type = type + add_child(curr) + curr_player = curr + player_array = { + "type":curr.type , + "texture":curr_player.sprite.texture, + "modulate":curr_player.sprite.modulate, + "rotation":curr_player.sprite.rotation_degrees + } +func change_player(): + var type = player_array["type"] + for child in get_children(): + if child.name == "spawner_"+type: + child.charges +=1 + child.adjust_look(child.charges) + delete_player() diff --git a/Components/dictionary.gd b/Components/dictionary.gd new file mode 100644 index 0000000..1820287 --- /dev/null +++ b/Components/dictionary.gd @@ -0,0 +1,101 @@ +extends Node + +var texture = { + "rock": preload("res://Images/Rock.png"), + "sun": preload("res://Images/Sun.png"), + "ice": preload("res://Images/Ice.png"), + "grass": preload("res://Images/Grass.png"), + "black": preload("res://Images/BlackHole.png") +} + +var name_ext = { + "R": "rock", + "G": "grass", + "S": "sun", + "I": "ice", + "B": "black" +} + + +var planets_lvl = { + "0": { "rock": 3, "sun": 5, "ice": 5, "grass": 0, "black": 0 }, + "1": { "rock": 3, "sun": 0, "ice": 0, "grass": 3, "black": 0 }, + "2": { "rock": 2, "sun": 2, "ice": 0, "grass": 4, "black": 0 }, + "3": { "rock": 5, "sun": 0, "ice": 0, "grass": 2, "black": 0 }, + "4": { "rock": 4, "sun": 3, "ice": 3, "grass": 0, "black": 0 }, + "5": { "rock": 1, "sun": 0, "ice": 0, "grass": 0, "black": 4 }, + "6": { "rock": 2, "sun": 1, "ice": 1, "grass": 6, "black": 1 }, + "7": { "rock": 5, "sun": 2, "ice": 2, "grass": 4, "black": 4 }, + "8": { "rock": 2, "sun": 2, "ice": 2, "grass": 2, "black": 2 }, +} +var map_lvl = { + "0": [["O", "-", "-", "-", "O"], + ["O", "-", "B", "B", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "S", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "I", "-", "O"], + ["O", "-", "-", "-", "O"]], + + "1": [["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"]], + + "2": [["O", "O", "-", "O", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "O", "-", "O", "O"]], + + "3": [["O", "-", "I", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "I", "-", "O"]], + + "4": [["O", "S", "-", "I", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"]], + + "5": [["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"], + ["O", "-", "-", "-", "O"]], + + "6": [["-", "-", "-", "-"], + ["-", "-", "-", "-"], + ["-", "-", "B", "-"], + ["-", "-", "-", "-"]], + + "7": [["-", "-", "-", "-", "-"], + ["-", "-", "-", "-", "-"], + ["-", "-", "-", "-", "-"], + ["-", "-", "-", "-", "-"], + ["-", "-", "-", "-", "-"]], + + "8": [["-", "-", "-", "-", "-"], + ["-", "B", "-", "-", "-"], + ["-", "-", "-", "B", "-"], + ["-", "-", "-", "-", "-"]], +} + +var label_lvl = { + "0": "", + "1": "Welcome! You must be our new empoyee, right? + + Here's a bunch of planets, just put them in any free space on the grid.", + "2": "This guy ordered some suns, too. + + Rocky planets can stand the heat, but grassy planets don't. Put them far apart!", + "3": "Same thing with icy planets: their cold aura might damage the grass. + + Oh, and of course I don't need to tell you not to put suns near icy planets, right?", + "4": "Note from the developer: I should probably have made different effects for intersecting auras, but the thought alone made me want to drop the whole game. Enjoy your '?'.", + "5": "Nasty black holes! Who would even order such things? + + These buggers suck anything that gets in their vicinity, so don't put anything close to them", + "6": "Alright, tutorial's over. + + Let's do something a little nastier, shall we?", + "7": "", + "8": "Last level. + + I know, the game is short, but I'm already out of Ideas and it's been two weeks", +} diff --git a/Components/gameplay.tscn b/Components/gameplay.tscn new file mode 100644 index 0000000..d4386c3 --- /dev/null +++ b/Components/gameplay.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=7 format=3 uid="uid://ccwl3llks0yht"] + +[ext_resource type="Script" path="res://Components/base.gd" id="1_0ugql"] +[ext_resource type="Texture2D" uid="uid://cltng1ui8ahj0" path="res://Images/Tiles.jpg" id="2_3n581"] +[ext_resource type="Script" path="res://Components/higlight_cell.gd" id="3_lxogb"] +[ext_resource type="Script" path="res://Music/Music_Changer.gd" id="5_vryqo"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_guvom"] +texture = ExtResource("2_3n581") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 + +[sub_resource type="TileSet" id="TileSet_eahiy"] +tile_size = Vector2i(80, 80) +custom_data_layer_0/name = "occupier" +custom_data_layer_0/type = 4 +sources/1 = SubResource("TileSetAtlasSource_guvom") + +[node name="Base" type="Node2D"] +script = ExtResource("1_0ugql") + +[node name="TileMap" type="TileMap" parent="."] +tile_set = SubResource("TileSet_eahiy") +cell_quadrant_size = 40 +format = 2 +layer_1/name = "" +layer_1/enabled = true +layer_1/modulate = Color(1, 1, 1, 1) +layer_1/y_sort_enabled = false +layer_1/y_sort_origin = 0 +layer_1/z_index = 0 +layer_1/tile_data = PackedInt32Array() +script = ExtResource("3_lxogb") + +[node name="Main" type="AudioStreamPlayer2D" parent="."] +script = ExtResource("5_vryqo") diff --git a/Components/gather_info.gd b/Components/gather_info.gd new file mode 100644 index 0000000..f0e38f9 --- /dev/null +++ b/Components/gather_info.gd @@ -0,0 +1,24 @@ +extends Node2D + +signal game_success +signal game_fail + +var base_scn = preload("res://Components/gameplay.tscn") +# Called when the node enters the scene tree for the first time. +func _ready(): + var level = self.name + + var base = base_scn.instantiate() + base.planets = Diction.planets_lvl[level] + base.map = Diction.map_lvl[level] + base.connect("game_success", forward.bind("success")) + base.connect("game_fail", forward.bind("fail")) + add_child(base) + + $Label.text = Diction.label_lvl[level] + +func forward(x): + if (x=="success"): + emit_signal("game_success") + else: + emit_signal("game_fail") diff --git a/Components/general_scene_changer.gd b/Components/general_scene_changer.gd new file mode 100644 index 0000000..56ae438 --- /dev/null +++ b/Components/general_scene_changer.gd @@ -0,0 +1,42 @@ +extends Node2D + + +# Called when the node enters the scene tree for the first time. +func _ready(): + for child in get_children(): + if child.name == "Play": + child.connect("pressed", play) + if child.name == "Credits": + child.connect("pressed", credits) + if child.name == "Menu": + child.connect("pressed", menu) + if child.name == "Map": + child.connect("pressed", map) + if child.name == "Mute": + child.connect("pressed", mute_unmute.bind(child)) + if child.name.is_valid_int(): + child.connect("pressed", to_level.bind(child.name)) + + +func play(): + LevelManager._go_to_level(1) + +func credits(): + LevelManager._go_to_credits() + +func menu(): + LevelManager._go_to_menu() + +func map(): + LevelManager._go_to_map() + +func to_level(x): + LevelManager._go_to_level(int(str(x))) + +func mute_unmute(child): + + if Muter.get_mute(): + child.icon = (load("res://Images/sound_on.png")) + else: + child.icon = (load("res://Images/sound_off.png")) + Muter.mute_unmute() diff --git a/Components/higlight_cell.gd b/Components/higlight_cell.gd new file mode 100644 index 0000000..2746e99 --- /dev/null +++ b/Components/higlight_cell.gd @@ -0,0 +1,136 @@ +extends TileMap + +var max_pos = {"x": 10, "y": 5} +var min_pos = {"x":4, "y":1} + +var occupier_arr = {} + +var prev_cell = null + +func calculateMin(): + return {"x":4, "y":((8-max_pos["y"]))/2} + +func draw_map(map): + var rng = RandomNumberGenerator.new() + min_pos = calculateMin() + max_pos = {"x": map[0].size()-1, "y": map.size()-1} + + for x in range(0, max_pos["x"]+1): + for y in range(0, max_pos["y"]+1): + if(map[y][x]=="-"): + occupier_arr[str(min_pos["x"]+x)+"-"+str(min_pos["y"]+y)] = "" + if(get_cell_atlas_coords(0,Vector2(min_pos["x"]+x,min_pos["y"]+y))==Vector2i(-1, -1)): + set_cell(0, Vector2(min_pos["x"]+x,min_pos["y"]+y), 1, Vector2(0,0)) + elif(map[y][x]=="O"): + occupier_arr[str(min_pos["x"]+x)+"-"+str(min_pos["y"]+y)] = "" + set_cell(0, Vector2(min_pos["x"]+x,min_pos["y"]+y), 1, Vector2(2,0)) + else: + occupy_slot(map_to_local(Vector2(min_pos["x"]+x,min_pos["y"]+y)), { + "type": Diction.name_ext[map[y][x]], + "texture": Diction.texture[Diction.name_ext[map[y][x]]], + "modulate": Color(1-rng.randf_range(0,0.1),1-rng.randf_range(0,0.1),1-rng.randf_range(0,0.1)), + "rotation": randf_range(-360,360) + }) + +func _process(_delta): + var mouse_pos = local_to_map(get_global_mouse_position()) + if(!in_range(mouse_pos)) or get_parent().curr_player == null: + if prev_cell != null: + set_cell(1, prev_cell, 1) + prev_cell = null + return + + if prev_cell == null: + prev_cell = mouse_pos + return + + if prev_cell != mouse_pos: + if(get_cell_atlas_coords(0,mouse_pos)!=Vector2i(2, 0)): + set_cell(1, mouse_pos, 1, Vector2(1,0)) + set_cell(1, prev_cell, 1) + + prev_cell = mouse_pos + +func occupy_slot(pos, player): + var mouse_pos = local_to_map(pos) + if(!in_range(mouse_pos) or get_cell_atlas_coords(0,mouse_pos)==Vector2i(2, 0)): + return false + + set_cell(0, mouse_pos, 1, Vector2(2,0)) + set_cell(1, mouse_pos, 1) + + if player.type!="rock" and player.type!="grass": + paint_neighbors(player.type, mouse_pos) + + var sprite = Sprite2D.new() + sprite.texture = player["texture"] + sprite.modulate = player["modulate"] + sprite.rotation_degrees = player["rotation"] + sprite.position = map_to_local(mouse_pos) + add_child(sprite) + + occupier_arr[str(mouse_pos.x)+"-"+str(mouse_pos.y)] = player['type'] + + return true + +func paint_neighbors(type, mouse_pos): + var neighbors = [ + get_neighbor_cell(mouse_pos, self.tile_set.CellNeighbor.CELL_NEIGHBOR_RIGHT_SIDE ), #CELL_NEIGHBOR_RIGHT_SIDE + get_neighbor_cell(mouse_pos, self.tile_set.CellNeighbor.CELL_NEIGHBOR_LEFT_SIDE ), #CELL_NEIGHBOR_LEFT_SIDE + get_neighbor_cell(mouse_pos, self.tile_set.CellNeighbor.CELL_NEIGHBOR_BOTTOM_SIDE ), #CELL_NEIGHBOR_BOTTOM_SIDE + get_neighbor_cell(mouse_pos, self.tile_set.CellNeighbor.CELL_NEIGHBOR_TOP_SIDE ), #CELL_NEIGHBOR_TOP_SIDE + ] + for neighbor in neighbors: + if(!in_range(neighbor) or get_cell_atlas_coords(0,neighbor)==Vector2i(2, 0)): + continue; + + if (get_cell_atlas_coords(0,neighbor)!=Vector2i(0, 0) and get_cell_atlas_coords(0,neighbor)!=Vector2i(-1, -1) and + !(type=="sun" and get_cell_atlas_coords(0,neighbor)==Vector2i(0, 1)) and + !(type=="ice" and get_cell_atlas_coords(0,neighbor)==Vector2i(1, 1))): + set_cell(0, neighbor, 1, Vector2(2,1)) + else: + if(type=="sun"): + set_cell(0, neighbor, 1, Vector2(0,1)) + if(type=="ice"): + set_cell(0, neighbor, 1, Vector2(1,1)) + if(type=="black"): + if(neighbor == neighbors[0]): + set_cell(0, neighbor, 1, Vector2(2,2)) + if(neighbor == neighbors[1]): + set_cell(0, neighbor, 1, Vector2(3,2)) + if(neighbor == neighbors[2]): + set_cell(0, neighbor, 1, Vector2(1,2)) + if(neighbor == neighbors[3]): + set_cell(0, neighbor, 1, Vector2(0,2)) + +func in_range(pos): + return bool(pos.x>=min_pos["x"] and pos.x<=min_pos["x"]+max_pos["x"] and pos.y>=min_pos["y"] and pos.y<=min_pos["y"]+max_pos["y"]) + +func check_success(pos, player): + var mouse_pos = local_to_map(pos) + var neighbors = [ + get_neighbor_cell(mouse_pos, 0 ), #CELL_NEIGHBOR_RIGHT_SIDE + get_neighbor_cell(mouse_pos, 4 ), #CELL_NEIGHBOR_LEFT_SIDE + get_neighbor_cell(mouse_pos, 8 ), #CELL_NEIGHBOR_BOTTOM_SIDE + get_neighbor_cell(mouse_pos, 12 ), #CELL_NEIGHBOR_TOP_SIDE + ] + + for neighbor in neighbors: + var source_id = self.get_cell_source_id(0, neighbor, false) + if(source_id == -1): + continue + + var occupier = occupier_arr[str(neighbor.x)+"-"+str(neighbor.y)] + + if (occupier=="black" or + (player.type=="black" and occupier != "") or + (player.type=="ice" and occupier == "sun") or + (player.type=="sun" and occupier == "ice") or + (player.type=="grass" and occupier == "sun") or + (player.type=="grass" and occupier == "ice") or + (player.type=="ice" and occupier == "grass") or + (player.type=="sun" and occupier == "grass")): + return false + + return true + diff --git a/Components/level_completed.tscn b/Components/level_completed.tscn new file mode 100644 index 0000000..b401730 --- /dev/null +++ b/Components/level_completed.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=6 format=3 uid="uid://nkjpbpsveojp"] + +[ext_resource type="Texture2D" uid="uid://lp5b8jgmg3g" path="res://Images/panel_level_over.png" id="1_3ww73"] +[ext_resource type="Texture2D" uid="uid://b1equ153xngag" path="res://Images/next.png" id="2_crt0o"] +[ext_resource type="Texture2D" uid="uid://c831drc16pkbk" path="res://Images/map_small.png" id="3_1osls"] + +[sub_resource type="LabelSettings" id="LabelSettings_ep2fd"] +line_spacing = 0.0 +font_size = 30 + +[sub_resource type="Theme" id="Theme_tesxp"] +default_font_size = 22 + +[node name="panel" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_3ww73") + +[node name="Label" type="Label" parent="."] +offset_left = -96.0 +offset_top = -113.0 +offset_right = 95.0 +offset_bottom = -13.0 +text = "Level +completed!" +label_settings = SubResource("LabelSettings_ep2fd") +horizontal_alignment = 1 + +[node name="Next" type="Button" parent="."] +offset_left = -87.0 +offset_right = 112.0 +offset_bottom = 68.0 +theme = SubResource("Theme_tesxp") +text = "Next level" +icon = ExtResource("2_crt0o") +flat = true + +[node name="Map" type="Button" parent="."] +offset_left = -86.0 +offset_top = 66.0 +offset_right = 89.0 +offset_bottom = 134.0 +theme = SubResource("Theme_tesxp") +text = "To map +" +icon = ExtResource("3_1osls") +flat = true diff --git a/Components/level_fail.tscn b/Components/level_fail.tscn new file mode 100644 index 0000000..fb5e298 --- /dev/null +++ b/Components/level_fail.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=7 format=3 uid="uid://cbgt7o417o8og"] + +[ext_resource type="Texture2D" uid="uid://lp5b8jgmg3g" path="res://Images/panel_level_over.png" id="1_fcgbh"] +[ext_resource type="Texture2D" uid="uid://bwxxlavill7em" path="res://Images/reset.png" id="2_0dcvu"] +[ext_resource type="Texture2D" uid="uid://c831drc16pkbk" path="res://Images/map_small.png" id="3_do5ir"] + +[sub_resource type="LabelSettings" id="LabelSettings_ep2fd"] +line_spacing = 0.0 +font_size = 30 + +[sub_resource type="Theme" id="Theme_0sxms"] +default_font_size = 22 + +[sub_resource type="Theme" id="Theme_ei5xv"] +default_font_size = 22 + +[node name="panel" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_fcgbh") + +[node name="Label" type="Label" parent="."] +offset_left = -96.0 +offset_top = -111.0 +offset_right = 95.0 +offset_bottom = -11.0 +text = "Level +failed!" +label_settings = SubResource("LabelSettings_ep2fd") +horizontal_alignment = 1 + +[node name="Reset" type="Button" parent="."] +offset_left = -83.0 +offset_right = 64.0 +offset_bottom = 68.0 +theme = SubResource("Theme_0sxms") +text = "Retry" +icon = ExtResource("2_0dcvu") +flat = true + +[node name="Map" type="Button" parent="."] +offset_left = -83.0 +offset_top = 66.0 +offset_right = 92.0 +offset_bottom = 134.0 +theme = SubResource("Theme_ei5xv") +text = "To map +" +icon = ExtResource("3_do5ir") +flat = true diff --git a/Components/level_manager.gd b/Components/level_manager.gd new file mode 100644 index 0000000..11a6cbd --- /dev/null +++ b/Components/level_manager.gd @@ -0,0 +1,27 @@ +extends Control + +var level_scn = preload("res://scenes/level.tscn") + +func _go_to_level(num): + get_tree().get_current_scene().queue_free() + + var root = get_tree().get_root() + + if(!Diction.planets_lvl.has(str(num))): + get_tree().change_scene_to_file("res://scenes/victory.tscn") + else: + var level = level_scn.instantiate() + level.name = "Level" + level.curr_level = num + root.add_child(level) + get_tree().set_current_scene(level) + +func _go_to_credits(): + get_tree().change_scene_to_file("res://scenes/credits.tscn") + +func _go_to_menu(): + get_tree().change_scene_to_file("res://scenes/menu.tscn") + +func _go_to_map(): + get_tree().change_scene_to_file("res://scenes/map.tscn") + diff --git a/Components/manage_win_lose.gd b/Components/manage_win_lose.gd new file mode 100644 index 0000000..e8a298f --- /dev/null +++ b/Components/manage_win_lose.gd @@ -0,0 +1,54 @@ +extends Control + +var base_scn = preload("res://scenes/level_inner.tscn") +var victory_panel = preload("res://Components/level_completed.tscn") +var fail_panel = preload("res://Components/level_fail.tscn") +signal game_success +signal game_fail + + +var curr_level = 1 +# Called when the node enters the scene tree for the first time. +func _ready(): + var base = base_scn.instantiate() + base.name = str(curr_level) + base.connect("game_success",_spawn_panel.bind("success")) + base.connect("game_fail",_spawn_panel.bind("fail")) + add_child(base) + + base.find_child("Reset").connect("pressed",_reset_level) + base.find_child("Map").connect("pressed",_to_map) + base.find_child("Mute").connect("pressed", mute_unmute.bind(base.find_child("Mute"))) + + +func _spawn_panel(panel): + if(panel == "success"): + var p = victory_panel.instantiate() + p.position = Vector2(576, 324) + add_child(p) + p.find_child("Next").connect("pressed",_next_level) + p.find_child("Map").connect("pressed",_to_map) + if(panel == "fail"): + var p = fail_panel.instantiate() + p.position = Vector2(576, 324) + add_child(p) + p.find_child("Reset").connect("pressed",_reset_level) + p.find_child("Map").connect("pressed",_to_map) + + +func _next_level(): + LevelManager._go_to_level(int(curr_level)+1) + +func _reset_level(): + LevelManager._go_to_level(int(curr_level)) + +func _to_map(): + LevelManager._go_to_map() + +func mute_unmute(child): + + if Muter.get_mute(): + child.icon = (load("res://Images/sound_on.png")) + else: + child.icon = (load("res://Images/sound_off.png")) + Muter.mute_unmute() diff --git a/Components/planet.tscn b/Components/planet.tscn new file mode 100644 index 0000000..952c842 --- /dev/null +++ b/Components/planet.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=5 format=3 uid="uid://wy72xrwtrek0"] + +[ext_resource type="Script" path="res://Components/sprite_follow_mouse.gd" id="1_1lk5a"] +[ext_resource type="Texture2D" uid="uid://ljtkplpv5okm" path="res://Images/Rock.png" id="2_8hn2a"] +[ext_resource type="Script" path="res://Components/sprite__variations.gd" id="3_6q0s6"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7fgh8"] +size = Vector2(80, 80) + +[node name="Area2D" type="Area2D"] +script = ExtResource("1_1lk5a") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("2_8hn2a") +script = ExtResource("3_6q0s6") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_7fgh8") diff --git a/Components/planet_spawner.gd b/Components/planet_spawner.gd new file mode 100644 index 0000000..0df88e2 --- /dev/null +++ b/Components/planet_spawner.gd @@ -0,0 +1,32 @@ +extends Button + +@export var type = "rock" +@export var charges = 3 + + +# Called when the node enters the scene tree for the first time. +func _ready(): + adjust_look(charges) + +func _on_pressed(): + if(charges <1): + return + if get_parent().curr_player != null: + get_parent().change_player() + get_parent().new_player(type) + charges -=1 + adjust_look(charges) + +func adjust_look(_charges): + for n in get_children(): + remove_child(n) + n.queue_free() + for i in range(_charges): + var sprite = Sprite2D.new() + sprite.texture = Diction.texture[type] + + sprite.position.x = (get_rect().size.x/2)+(float(i)-float(charges/2))*10 + sprite.position.y = get_rect().size.y/2 + add_child(sprite) + + AudioPlayer._play(type) diff --git a/Components/spawner.tscn b/Components/spawner.tscn new file mode 100644 index 0000000..4f3e357 --- /dev/null +++ b/Components/spawner.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=3 uid="uid://dcqe7738k3qwj"] + +[ext_resource type="Script" path="res://Components/planet_spawner.gd" id="1_5ujup"] + +[node name="Spawner" type="Button"] +offset_right = 140.0 +offset_bottom = 70.0 +flat = true +script = ExtResource("1_5ujup") + +[connection signal="pressed" from="." to="." method="_on_pressed"] diff --git a/Components/sprite__variations.gd b/Components/sprite__variations.gd new file mode 100644 index 0000000..b533e93 --- /dev/null +++ b/Components/sprite__variations.gd @@ -0,0 +1,12 @@ +extends Sprite2D + +var rng = RandomNumberGenerator.new() +# Called when the node enters the scene tree for the first time. +func _ready(): + modulate = Color(1-rng.randf_range(0,0.1),1-rng.randf_range(0,0.1),1-rng.randf_range(0,0.1)) + rotation_degrees = randf_range(-360,360) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass diff --git a/Components/sprite_follow_mouse.gd b/Components/sprite_follow_mouse.gd new file mode 100644 index 0000000..85711ff --- /dev/null +++ b/Components/sprite_follow_mouse.gd @@ -0,0 +1,11 @@ +extends Area2D + +@export var type = "planet" + +@onready var sprite = $Sprite2D + +func _ready(): + sprite.texture = Diction.texture[type] + +func _process(_delta): + global_position = get_global_mouse_position() diff --git a/Components/sprite_snap.gd b/Components/sprite_snap.gd new file mode 100644 index 0000000..a8117e4 --- /dev/null +++ b/Components/sprite_snap.gd @@ -0,0 +1,21 @@ +extends Node2D + + +@onready var _map = $TileMap +var min_x = 0 +var min_y = 0 +var max_x = 10 +var max_y = 10 + +var max_border = 100 + +var prev_coord = null + +func _process(_delta): + var mouse_pos = _map.local_to_map(get_global_mouse_position()) + + _map.set_cell(0, mouse_pos, 0, Vector2(1,0)) + if prev_coord != null and prev_coord != mouse_pos: + _map.set_cell(0, prev_coord, 0, Vector2(0,0)) + + prev_coord = mouse_pos diff --git a/change_level.gd b/change_level.gd new file mode 100644 index 0000000..2707516 --- /dev/null +++ b/change_level.gd @@ -0,0 +1,14 @@ +extends Node + + +func go_to_level(num): + get_tree().change_scene("res://scenes/level.tscn") + +func go_to_menu(): + get_tree().change_scene("res://scenes/menu.tscn") + +func go_to_credits(): + get_tree().change_scene("res://scenes/credits.tscn") + +func go_to_level_map(): + get_tree().change_scene("res://scenes/level_map.tscn") diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..adc26df --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/scenes/credits.tscn b/scenes/credits.tscn new file mode 100644 index 0000000..2ea91fb --- /dev/null +++ b/scenes/credits.tscn @@ -0,0 +1,97 @@ +[gd_scene load_steps=13 format=3 uid="uid://bao5s24kn8qpa"] + +[ext_resource type="Script" path="res://Components/Background.gd" id="1_423tl"] +[ext_resource type="Script" path="res://Components/general_scene_changer.gd" id="1_xxc27"] +[ext_resource type="Texture2D" uid="uid://b2tu02r3uttdi" path="res://Images/panel_title.png" id="2_gf2cj"] +[ext_resource type="Texture2D" uid="uid://bm167coy4emtp" path="res://Images/bg_tiles.jpg" id="2_w3675"] +[ext_resource type="Script" path="res://Music/Music_Changer.gd" id="3_dn2m5"] +[ext_resource type="Texture2D" uid="uid://cr7vrio6w8l41" path="res://Images/map_big.png" id="4_pc6ee"] +[ext_resource type="Texture2D" uid="uid://c2ao8hiirsvj3" path="res://Images/sound_on.png" id="7_8l5rl"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ckc8x"] +texture = ExtResource("2_w3675") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +0:3/0 = 0 +1:3/0 = 0 +2:3/0 = 0 +3:3/0 = 0 + +[sub_resource type="TileSet" id="TileSet_45bsw"] +tile_size = Vector2i(80, 80) +sources/0 = SubResource("TileSetAtlasSource_ckc8x") + +[sub_resource type="LabelSettings" id="LabelSettings_dyh2m"] +font_size = 64 + +[sub_resource type="Theme" id="Theme_vuhen"] +default_font_size = 40 + +[sub_resource type="LabelSettings" id="LabelSettings_3s42i"] +font_size = 22 + +[node name="Node2D" type="Node2D"] +script = ExtResource("1_xxc27") + +[node name="Title_back" type="Sprite2D" parent="."] +position = Vector2(576, 120) +texture = ExtResource("2_gf2cj") + +[node name="Background" type="TileMap" parent="."] +tile_set = SubResource("TileSet_45bsw") +format = 2 +script = ExtResource("1_423tl") + +[node name="Label" type="Label" parent="."] +offset_top = 70.0 +offset_right = 1153.0 +offset_bottom = 220.0 +text = "Credits" +label_settings = SubResource("LabelSettings_dyh2m") +horizontal_alignment = 1 + +[node name="Menu" type="Button" parent="."] +offset_left = 29.0 +offset_top = 538.0 +offset_right = 501.0 +offset_bottom = 626.0 +theme = SubResource("Theme_vuhen") +text = "Back to main menu" +icon = ExtResource("4_pc6ee") +flat = true + +[node name="Title" type="AudioStreamPlayer2D" parent="."] +script = ExtResource("3_dn2m5") + +[node name="Label2" type="Label" parent="."] +offset_left = 68.0 +offset_top = 266.0 +offset_right = 1078.0 +offset_bottom = 478.0 +text = "Made for Ludum Dare 54, whose theme was \"limited space\". +This was made for Extra category, though, so instead of a weekend it actually took 2 whole weeks + +Game by Cookie_CHR +Music by Kevin MacLeod (incompetech.com) +Sounds by freesound.org" +label_settings = SubResource("LabelSettings_3s42i") +autowrap_mode = 2 + +[node name="Mute" type="Button" parent="."] +offset_left = 1035.0 +offset_top = 537.0 +offset_right = 1123.0 +offset_bottom = 625.0 +icon = ExtResource("7_8l5rl") +flat = true diff --git a/scenes/level.tscn b/scenes/level.tscn new file mode 100644 index 0000000..25acc8f --- /dev/null +++ b/scenes/level.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://dvc1i3crokekb"] + +[ext_resource type="Script" path="res://Components/manage_win_lose.gd" id="1_1sjci"] + +[node name="Level" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_1sjci") diff --git a/scenes/level_inner.tscn b/scenes/level_inner.tscn new file mode 100644 index 0000000..6eb5c0b --- /dev/null +++ b/scenes/level_inner.tscn @@ -0,0 +1,90 @@ +[gd_scene load_steps=12 format=3 uid="uid://c4ar0urinkumn"] + +[ext_resource type="Script" path="res://Components/gather_info.gd" id="1_mu346"] +[ext_resource type="Texture2D" uid="uid://bm167coy4emtp" path="res://Images/bg_tiles.jpg" id="2_yirj8"] +[ext_resource type="Script" path="res://Components/Background.gd" id="3_oqvqd"] +[ext_resource type="Texture2D" uid="uid://bwmvqhr07rn8f" path="res://Images/panel_left.png" id="4_d5jl4"] +[ext_resource type="Texture2D" uid="uid://bwxxlavill7em" path="res://Images/reset.png" id="5_4snwg"] +[ext_resource type="Texture2D" uid="uid://1w1ni6nwrk2g" path="res://Images/panel_right.png" id="5_5pvxa"] +[ext_resource type="Texture2D" uid="uid://c831drc16pkbk" path="res://Images/map_small.png" id="7_ac74y"] +[ext_resource type="Texture2D" uid="uid://c2ao8hiirsvj3" path="res://Images/sound_on.png" id="8_2lwdi"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ckc8x"] +texture = ExtResource("2_yirj8") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +0:3/0 = 0 +1:3/0 = 0 +2:3/0 = 0 +3:3/0 = 0 + +[sub_resource type="TileSet" id="TileSet_jkdn8"] +tile_size = Vector2i(80, 80) +sources/0 = SubResource("TileSetAtlasSource_ckc8x") + +[sub_resource type="Theme" id="Theme_oykpo"] +default_font_size = 22 + +[node name="1" type="Node2D"] +script = ExtResource("1_mu346") + +[node name="Background" type="TileMap" parent="."] +tile_set = SubResource("TileSet_jkdn8") +format = 2 +script = ExtResource("3_oqvqd") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("4_d5jl4") +centered = false + +[node name="Sprite2D2" type="Sprite2D" parent="."] +position = Vector2(912, -1) +texture = ExtResource("5_5pvxa") +centered = false + +[node name="Label" type="Label" parent="."] +offset_left = 50.0 +offset_top = 143.0 +offset_right = 190.0 +offset_bottom = 512.0 +autowrap_mode = 2 + +[node name="Reset" type="Button" parent="."] +offset_left = 950.0 +offset_top = 52.0 +offset_right = 1101.0 +offset_bottom = 120.0 +theme = SubResource("Theme_oykpo") +text = "Reset" +icon = ExtResource("5_4snwg") +flat = true + +[node name="Map" type="Button" parent="."] +offset_left = 950.0 +offset_top = 116.0 +offset_right = 1112.0 +offset_bottom = 184.0 +theme = SubResource("Theme_oykpo") +text = "To map" +icon = ExtResource("7_ac74y") +flat = true + +[node name="Mute" type="Button" parent="."] +offset_left = 908.0 +offset_top = 544.0 +offset_right = 996.0 +offset_bottom = 632.0 +theme = SubResource("Theme_oykpo") +icon = ExtResource("8_2lwdi") +flat = true diff --git a/scenes/manage_win_lose.gd b/scenes/manage_win_lose.gd new file mode 100644 index 0000000..03215a5 --- /dev/null +++ b/scenes/manage_win_lose.gd @@ -0,0 +1,15 @@ +extends Control + +signal game_success +signal game_fail + + +var curr_level = 1 +# Called when the node enters the scene tree for the first time. +func _ready(): + get_child(0).connect("game_success",_next_level) + pass # Replace with function body. + + +func _next_level(): + LevelManager._go_to_level(curr_level+1) diff --git a/scenes/map.tscn b/scenes/map.tscn new file mode 100644 index 0000000..c1c64bd --- /dev/null +++ b/scenes/map.tscn @@ -0,0 +1,165 @@ +[gd_scene load_steps=12 format=3 uid="uid://bwfsv1qjmeviv"] + +[ext_resource type="Script" path="res://Components/general_scene_changer.gd" id="1_8m7k7"] +[ext_resource type="Texture2D" uid="uid://bm167coy4emtp" path="res://Images/bg_tiles.jpg" id="1_ghmmv"] +[ext_resource type="Script" path="res://Components/Background.gd" id="2_uqh1v"] +[ext_resource type="Texture2D" uid="uid://br1a16wisvhv1" path="res://Images/play.png" id="3_o31g5"] +[ext_resource type="Texture2D" uid="uid://c2jt84cjjanl0" path="res://Images/credits.png" id="4_tjfhq"] +[ext_resource type="Texture2D" uid="uid://ces3pya5ahesu" path="res://Images/button_generic.png" id="6_7q4qy"] +[ext_resource type="Texture2D" uid="uid://c2ao8hiirsvj3" path="res://Images/sound_on.png" id="7_cvauv"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ckc8x"] +texture = ExtResource("1_ghmmv") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +0:3/0 = 0 +1:3/0 = 0 +2:3/0 = 0 +3:3/0 = 0 + +[sub_resource type="TileSet" id="TileSet_i8p2w"] +tile_size = Vector2i(80, 80) +sources/0 = SubResource("TileSetAtlasSource_ckc8x") + +[sub_resource type="Theme" id="Theme_q4yhi"] +default_font_size = 40 + +[sub_resource type="Theme" id="Theme_0nnai"] +default_font_size = 60 + +[node name="Node2D" type="Node2D"] +script = ExtResource("1_8m7k7") + +[node name="Background" type="TileMap" parent="."] +tile_set = SubResource("TileSet_i8p2w") +format = 2 +script = ExtResource("2_uqh1v") + +[node name="Play" type="Button" parent="."] +offset_left = 35.0 +offset_top = 536.0 +offset_right = 451.0 +offset_bottom = 624.0 +theme = SubResource("Theme_q4yhi") +text = " Play from level 1" +icon = ExtResource("3_o31g5") +flat = true + +[node name="Credits" type="Button" parent="."] +offset_left = 673.0 +offset_top = 534.0 +offset_right = 909.0 +offset_bottom = 622.0 +theme = SubResource("Theme_q4yhi") +text = " Credits" +icon = ExtResource("4_tjfhq") +flat = true + +[node name="1" type="Button" parent="."] +offset_left = 216.0 +offset_top = 93.0 +offset_right = 384.0 +offset_bottom = 261.0 +theme = SubResource("Theme_0nnai") +text = "1 +" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="2" type="Button" parent="."] +offset_left = 398.0 +offset_top = 93.0 +offset_right = 566.0 +offset_bottom = 261.0 +theme = SubResource("Theme_0nnai") +text = "2" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="3" type="Button" parent="."] +offset_left = 576.0 +offset_top = 93.0 +offset_right = 744.0 +offset_bottom = 261.0 +theme = SubResource("Theme_0nnai") +text = "3" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="4" type="Button" parent="."] +offset_left = 752.0 +offset_top = 93.0 +offset_right = 920.0 +offset_bottom = 261.0 +theme = SubResource("Theme_0nnai") +text = "4" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="5" type="Button" parent="."] +offset_left = 216.0 +offset_top = 273.0 +offset_right = 384.0 +offset_bottom = 441.0 +theme = SubResource("Theme_0nnai") +text = "5" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="6" type="Button" parent="."] +offset_left = 398.0 +offset_top = 273.0 +offset_right = 566.0 +offset_bottom = 441.0 +theme = SubResource("Theme_0nnai") +text = "6" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="7" type="Button" parent="."] +offset_left = 576.0 +offset_top = 273.0 +offset_right = 744.0 +offset_bottom = 441.0 +theme = SubResource("Theme_0nnai") +text = "7" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="8" type="Button" parent="."] +offset_left = 752.0 +offset_top = 273.0 +offset_right = 920.0 +offset_bottom = 441.0 +theme = SubResource("Theme_0nnai") +text = "8 +" +icon = ExtResource("6_7q4qy") +flat = true +icon_alignment = 1 + +[node name="Mute" type="Button" parent="."] +offset_left = 1035.0 +offset_top = 537.0 +offset_right = 1123.0 +offset_bottom = 625.0 +icon = ExtResource("7_cvauv") +flat = true diff --git a/scenes/menu.tscn b/scenes/menu.tscn new file mode 100644 index 0000000..eca9b9a --- /dev/null +++ b/scenes/menu.tscn @@ -0,0 +1,121 @@ +[gd_scene load_steps=15 format=3 uid="uid://idke5d3nbvlb"] + +[ext_resource type="Script" path="res://Components/general_scene_changer.gd" id="1_67dfy"] +[ext_resource type="Script" path="res://Components/Background.gd" id="1_n26um"] +[ext_resource type="Texture2D" uid="uid://br1a16wisvhv1" path="res://Images/play.png" id="2_xhpm7"] +[ext_resource type="Texture2D" uid="uid://bm167coy4emtp" path="res://Images/bg_tiles.jpg" id="2_xtxga"] +[ext_resource type="Texture2D" uid="uid://c2jt84cjjanl0" path="res://Images/credits.png" id="3_wi1kt"] +[ext_resource type="Texture2D" uid="uid://b2tu02r3uttdi" path="res://Images/panel_title.png" id="4_h1wkc"] +[ext_resource type="Script" path="res://Music/Music_Changer.gd" id="5_p47x8"] +[ext_resource type="Texture2D" uid="uid://cr7vrio6w8l41" path="res://Images/map_big.png" id="5_sekhn"] +[ext_resource type="Texture2D" uid="uid://c2ao8hiirsvj3" path="res://Images/sound_on.png" id="9_nwuj2"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ckc8x"] +texture = ExtResource("2_xtxga") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +0:3/0 = 0 +1:3/0 = 0 +2:3/0 = 0 +3:3/0 = 0 + +[sub_resource type="TileSet" id="TileSet_rdt8d"] +tile_size = Vector2i(80, 80) +sources/0 = SubResource("TileSetAtlasSource_ckc8x") + +[sub_resource type="Theme" id="Theme_bdtx7"] +default_font_size = 40 + +[sub_resource type="LabelSettings" id="LabelSettings_o5ulb"] +font_size = 20 + +[sub_resource type="LabelSettings" id="LabelSettings_hit1v"] +font_size = 70 + +[node name="Menu" type="Node2D"] +script = ExtResource("1_67dfy") + +[node name="Background" type="TileMap" parent="."] +tile_set = SubResource("TileSet_rdt8d") +format = 2 +script = ExtResource("1_n26um") + +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(576, 120) +texture = ExtResource("4_h1wkc") + +[node name="Play" type="Button" parent="."] +offset_left = 176.0 +offset_top = 302.0 +offset_right = 592.0 +offset_bottom = 390.0 +theme = SubResource("Theme_bdtx7") +text = " Play from level 1" +icon = ExtResource("2_xhpm7") +flat = true + +[node name="Map" type="Button" parent="."] +offset_left = 176.0 +offset_top = 394.0 +offset_right = 419.0 +offset_bottom = 482.0 +theme = SubResource("Theme_bdtx7") +text = " To map" +icon = ExtResource("5_sekhn") +flat = true + +[node name="Credits" type="Button" parent="."] +offset_left = 176.0 +offset_top = 487.0 +offset_right = 412.0 +offset_bottom = 575.0 +theme = SubResource("Theme_bdtx7") +text = " Credits" +icon = ExtResource("3_wi1kt") +flat = true + +[node name="Title" type="AudioStreamPlayer2D" parent="."] +script = ExtResource("5_p47x8") + +[node name="Title_label" type="Label" parent="."] +offset_top = 38.0 +offset_right = 1153.0 +offset_bottom = 188.0 +text = "Welcome to" +label_settings = SubResource("LabelSettings_o5ulb") +horizontal_alignment = 1 + +[node name="Title_label2" type="Label" parent="."] +offset_top = 65.0 +offset_right = 1153.0 +offset_bottom = 215.0 +text = "S. P. Ace Ltd" +label_settings = SubResource("LabelSettings_hit1v") +horizontal_alignment = 1 + +[node name="Title_label3" type="Label" parent="."] +offset_top = 158.0 +offset_right = 1153.0 +offset_bottom = 223.0 +text = "Where we provide planets for all your universal needs!" +label_settings = SubResource("LabelSettings_o5ulb") +horizontal_alignment = 1 + +[node name="Mute" type="Button" parent="."] +offset_left = 1035.0 +offset_top = 537.0 +offset_right = 1123.0 +offset_bottom = 625.0 +icon = ExtResource("9_nwuj2") +flat = true diff --git a/scenes/victory.tscn b/scenes/victory.tscn new file mode 100644 index 0000000..bbc405d --- /dev/null +++ b/scenes/victory.tscn @@ -0,0 +1,77 @@ +[gd_scene load_steps=11 format=3 uid="uid://ckw1xtbjh8ww3"] + +[ext_resource type="Script" path="res://Components/general_scene_changer.gd" id="1_do0t6"] +[ext_resource type="Texture2D" uid="uid://bm167coy4emtp" path="res://Images/bg_tiles.jpg" id="2_k07c0"] +[ext_resource type="Script" path="res://Components/Background.gd" id="2_uq73q"] +[ext_resource type="Texture2D" uid="uid://br1a16wisvhv1" path="res://Images/play.png" id="3_cq5fk"] +[ext_resource type="Texture2D" uid="uid://c2jt84cjjanl0" path="res://Images/credits.png" id="4_ja667"] +[ext_resource type="Script" path="res://Music/Music_Changer.gd" id="5_5ahf7"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ckc8x"] +texture = ExtResource("2_k07c0") +texture_region_size = Vector2i(80, 80) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +3:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +3:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +3:2/0 = 0 +0:3/0 = 0 +1:3/0 = 0 +2:3/0 = 0 +3:3/0 = 0 + +[sub_resource type="TileSet" id="TileSet_j64ai"] +tile_size = Vector2i(80, 80) +sources/0 = SubResource("TileSetAtlasSource_ckc8x") + +[sub_resource type="LabelSettings" id="LabelSettings_lbbq6"] +font_size = 64 + +[sub_resource type="Theme" id="Theme_rbj1f"] +default_font_size = 40 + +[node name="Victory" type="Node2D"] +script = ExtResource("1_do0t6") + +[node name="Background" type="TileMap" parent="."] +tile_set = SubResource("TileSet_j64ai") +format = 2 +script = ExtResource("2_uq73q") + +[node name="Label" type="Label" parent="."] +offset_right = 1153.0 +offset_bottom = 150.0 +text = "Congratulations, +you won the game!" +label_settings = SubResource("LabelSettings_lbbq6") +horizontal_alignment = 1 + +[node name="Play" type="Button" parent="."] +offset_left = 176.0 +offset_top = 279.0 +offset_right = 470.0 +offset_bottom = 367.0 +theme = SubResource("Theme_rbj1f") +text = " Play again" +icon = ExtResource("3_cq5fk") +flat = true + +[node name="Credits" type="Button" parent="."] +offset_left = 176.0 +offset_top = 378.0 +offset_right = 412.0 +offset_bottom = 466.0 +theme = SubResource("Theme_rbj1f") +text = " Credits" +icon = ExtResource("4_ja667") +flat = true + +[node name="Title" type="AudioStreamPlayer2D" parent="."] +script = ExtResource("5_5ahf7")