From accf24ea08dde8240cb2ed69507a80ccfdcb6f88 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 17 Sep 2025 19:25:22 +0200 Subject: [PATCH 1/4] Added Main Menu --- building_generator.tscn | 13 ++++ buildings/building.gd | 7 +- enemies/ghost animation/Ghost 1.png.import | 6 ++ enemies/ghost animation/Ghost 2.png.import | 6 ++ enemies/ghost animation/Ghost 3.png.import | 6 ++ enemies/ghost animation/Ghost 4.png.import | 6 ++ enemies/ghost animation/Ghost 5.png.import | 6 ++ enemies/ghost.gd | 4 +- items/bow.tscn | 5 +- items/item.gd | 7 +- items/updash.tscn | 5 +- main.tscn | 4 +- main_menu/main_menu.gd | 6 ++ main_menu/main_menu.gd.uid | 1 + main_menu/main_menu.tscn | 73 +++++++++++++++++++ player/Heart Grey.png.import | 6 ++ player/Heart.png.import | 6 ++ player/Heart_cut Grey.png.import | 6 ++ player/Heart_cut.png.import | 6 ++ project.godot | 2 +- .../Background Prototype Layer 1.png.import | 6 ++ .../Background Prototype Layer 2.png.import | 6 ++ .../Background Prototype Layer 3.png.import | 6 ++ .../Background Prototype Layer 4.png.import | 6 ++ world/Background prototype.png.import | 6 ++ world/building_generator.gd | 5 +- world/earth.tscn | 4 +- 27 files changed, 205 insertions(+), 15 deletions(-) create mode 100644 building_generator.tscn create mode 100644 main_menu/main_menu.gd create mode 100644 main_menu/main_menu.gd.uid create mode 100644 main_menu/main_menu.tscn diff --git a/building_generator.tscn b/building_generator.tscn new file mode 100644 index 0000000..99aa6c3 --- /dev/null +++ b/building_generator.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3 uid="uid://ceg7ahpj5x12g"] + +[ext_resource type="Script" uid="uid://colvx6wq0e8n7" path="res://world/building_generator.gd" id="1_cwnke"] + +[node name="Building Generator" type="Node"] +script = ExtResource("1_cwnke") +initial_buildings = 10 + +[node name="Timer" type="Timer" parent="."] +wait_time = 2.5 +autostart = true + +[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/buildings/building.gd b/buildings/building.gd index 259d82e..2bc7495 100644 --- a/buildings/building.gd +++ b/buildings/building.gd @@ -16,9 +16,12 @@ func _ready() -> void: await get_tree().create_timer(0).timeout if get_node_or_null("EnemyList") != null: - for enemy in $EnemyList.get_children(): + var enemies = $EnemyList.get_children() + + $EnemyList.reparent(get_tree().get_root().get_node("main"), false) + + for enemy in enemies: var oldpos = enemy.position; - enemy.reparent(get_tree().get_root().get_node("main")) enemy.position = get_world_position(oldpos) if(enemy.has_method("init_at_horizontal_distortion")): enemy.init_at_horizontal_distortion(enemy.position.length() / grid.ground_radius) diff --git a/enemies/ghost animation/Ghost 1.png.import b/enemies/ghost animation/Ghost 1.png.import index 305b740..b1d0f88 100644 --- a/enemies/ghost animation/Ghost 1.png.import +++ b/enemies/ghost animation/Ghost 1.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Ghost 1.png-43131954ed622829dc5453ddf6a96b4c. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/enemies/ghost animation/Ghost 2.png.import b/enemies/ghost animation/Ghost 2.png.import index 4ee80ea..87f2b9b 100644 --- a/enemies/ghost animation/Ghost 2.png.import +++ b/enemies/ghost animation/Ghost 2.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Ghost 2.png-67077adaa01a71a5c0b85fac254bdf8e. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/enemies/ghost animation/Ghost 3.png.import b/enemies/ghost animation/Ghost 3.png.import index 932de75..5d4f743 100644 --- a/enemies/ghost animation/Ghost 3.png.import +++ b/enemies/ghost animation/Ghost 3.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Ghost 3.png-18da238556f83c92715d2db31a14d159. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/enemies/ghost animation/Ghost 4.png.import b/enemies/ghost animation/Ghost 4.png.import index 8c6d724..1ac4e37 100644 --- a/enemies/ghost animation/Ghost 4.png.import +++ b/enemies/ghost animation/Ghost 4.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Ghost 4.png-45ba6df3ef207a5eff72f5f0036139d6. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/enemies/ghost animation/Ghost 5.png.import b/enemies/ghost animation/Ghost 5.png.import index 98ac10c..c47e6e7 100644 --- a/enemies/ghost animation/Ghost 5.png.import +++ b/enemies/ghost animation/Ghost 5.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Ghost 5.png-08f0125e59cfd0173a5d36d75efeae60. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/enemies/ghost.gd b/enemies/ghost.gd index bb3cfde..698b8f8 100644 --- a/enemies/ghost.gd +++ b/enemies/ghost.gd @@ -11,9 +11,11 @@ var aggro_range = 900 var chase_range = 1400 func _ready() -> void: - player = get_tree().get_root().get_node("main/Player") + player = get_tree().get_root().get_node_or_null("main/Player") func _physics_process(delta: float) -> void: + if !is_instance_valid(player): + return var dist = (position - player.position).length() if(dist > chase_range): diff --git a/items/bow.tscn b/items/bow.tscn index 457a3bd..1062660 100644 --- a/items/bow.tscn +++ b/items/bow.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=5 format=3 uid="uid://ddn025xnjngko"] +[gd_scene load_steps=6 format=3 uid="uid://ddn025xnjngko"] [ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/bow.gd" id="1_xppub"] [ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/arrow.tscn" id="2_0id2q"] [ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_gllxn"] +[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="4_0id2q"] [sub_resource type="CircleShape2D" id="CircleShape2D_gllxn"] @@ -13,6 +14,8 @@ script = ExtResource("1_xppub") arrow_scene = ExtResource("2_0id2q") sprite = ExtResource("2_gllxn") +[node name="EarthAligner" parent="." instance=ExtResource("4_0id2q")] + [node name="CollisionShape2D" type="CollisionShape2D" parent="."] scale = Vector2(3.1, 3.1) shape = SubResource("CircleShape2D_gllxn") diff --git a/items/item.gd b/items/item.gd index 43e8541..4d7547a 100644 --- a/items/item.gd +++ b/items/item.gd @@ -1,8 +1,8 @@ class_name Item extends Area2D -@onready var player = get_tree().get_root().get_node("main/Player") +@onready var player = get_tree().get_root().get_node_or_null("main/Player") -func _physics_process(delta: float) -> void: - if(overlaps_body(player)): +func _physics_process(_delta: float) -> void: + if(is_instance_valid(player) and overlaps_body(player)): if(self.has_method("collect") and collect()): set_deferred("monitoring", false) set_deferred("monitorable", false) @@ -14,3 +14,4 @@ func collect_animation(): func collect(): push_error("Please specify item collection behavior") + return false diff --git a/items/updash.tscn b/items/updash.tscn index e2026f0..05880fd 100644 --- a/items/updash.tscn +++ b/items/updash.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://ewe36lqcjojk"] +[gd_scene load_steps=5 format=3 uid="uid://ewe36lqcjojk"] [ext_resource type="Script" uid="uid://bbwsc2a2hd0ow" path="res://items/updash.gd" id="1_ghbl6"] [ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="1_ptc3l"] +[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_ktv3s"] [sub_resource type="CircleShape2D" id="CircleShape2D_ghbl6"] @@ -17,3 +18,5 @@ shape = SubResource("CircleShape2D_ghbl6") modulate = Color(1, 0, 1, 1) scale = Vector2(0.45, 0.45) texture = ExtResource("1_ptc3l") + +[node name="EarthAligner" parent="." instance=ExtResource("3_ktv3s")] diff --git a/main.tscn b/main.tscn index d160a2d..46c7d90 100644 --- a/main.tscn +++ b/main.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=9 format=3 uid="uid://cxo6bq26huau7"] +[gd_scene load_steps=8 format=3 uid="uid://cxo6bq26huau7"] [ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"] -[ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="2_lquwl"] [ext_resource type="PackedScene" uid="uid://jjoyj1ldafkf" path="res://world/earth.tscn" id="3_lquwl"] [ext_resource type="Script" uid="uid://colvx6wq0e8n7" path="res://world/building_generator.gd" id="4_1bvp3"] [ext_resource type="PackedScene" uid="uid://73g8y37skebh" path="res://item_ui/item_ui.tscn" id="6_4c57u"] @@ -13,7 +12,6 @@ [node name="Earth" parent="." instance=ExtResource("3_lquwl")] unique_name_in_owner = true -script = ExtResource("2_lquwl") [node name="Player" parent="." instance=ExtResource("2_1bvp3")] unique_name_in_owner = true diff --git a/main_menu/main_menu.gd b/main_menu/main_menu.gd new file mode 100644 index 0000000..d3a81eb --- /dev/null +++ b/main_menu/main_menu.gd @@ -0,0 +1,6 @@ +extends Node + + + +func _on_button_start_pressed() -> void: + get_tree().change_scene_to_file("res://main.tscn") diff --git a/main_menu/main_menu.gd.uid b/main_menu/main_menu.gd.uid new file mode 100644 index 0000000..b66e92c --- /dev/null +++ b/main_menu/main_menu.gd.uid @@ -0,0 +1 @@ +uid://bg4qx85we014d diff --git a/main_menu/main_menu.tscn b/main_menu/main_menu.tscn new file mode 100644 index 0000000..e27d15c --- /dev/null +++ b/main_menu/main_menu.tscn @@ -0,0 +1,73 @@ +[gd_scene load_steps=9 format=3 uid="uid://dpkr8yoobtej6"] + +[ext_resource type="Script" uid="uid://bg4qx85we014d" path="res://main_menu/main_menu.gd" id="1_bws42"] +[ext_resource type="PackedScene" uid="uid://jjoyj1ldafkf" path="res://world/earth.tscn" id="1_oa53l"] +[ext_resource type="Script" uid="uid://colvx6wq0e8n7" path="res://world/building_generator.gd" id="2_d3a7t"] +[ext_resource type="Theme" uid="uid://dwlus1hjwtch4" path="res://large_theme.tres" id="3_3shxk"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_d3a7t"] +bg_color = Color(0, 0.7529412, 0, 1) +draw_center = false +corner_radius_top_left = 350 +corner_radius_top_right = 350 +corner_radius_bottom_right = 350 +corner_radius_bottom_left = 350 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3shxk"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bws42"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3f7m4"] + +[node name="main" type="Node"] +script = ExtResource("1_bws42") + +[node name="Earth" parent="." instance=ExtResource("1_oa53l")] +unique_name_in_owner = true + +[node name="Camera2D" type="Camera2D" parent="."] +zoom = Vector2(0.12, 0.12) + +[node name="Building Generator" type="Node" parent="."] +script = ExtResource("2_d3a7t") +initial_buildings = 250 +initial_spawn_protection = false + +[node name="Timer" type="Timer" parent="Building Generator"] + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="PanelContainer" type="PanelContainer" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -350.0 +offset_top = -350.0 +offset_right = 350.0 +offset_bottom = 350.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("3_3shxk") +theme_override_styles/panel = SubResource("StyleBoxFlat_d3a7t") + +[node name="ButtonStart" type="Button" parent="CanvasLayer/Control/PanelContainer"] +layout_mode = 2 +theme_type_variation = &"FlatButton" +theme_override_styles/pressed = SubResource("StyleBoxEmpty_3shxk") +theme_override_styles/hover = SubResource("StyleBoxEmpty_bws42") +theme_override_styles/focus = SubResource("StyleBoxEmpty_3f7m4") +text = "Play Again" + +[connection signal="timeout" from="Building Generator/Timer" to="Building Generator" method="_on_timer_timeout"] +[connection signal="pressed" from="CanvasLayer/Control/PanelContainer/ButtonStart" to="." method="_on_button_start_pressed"] diff --git a/player/Heart Grey.png.import b/player/Heart Grey.png.import index 4683b68..4913ba6 100644 --- a/player/Heart Grey.png.import +++ b/player/Heart Grey.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Heart Grey.png-6b86b8edc4802c3a483d9a14eb7ce1 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Heart.png.import b/player/Heart.png.import index 38455ee..dc7cbcd 100644 --- a/player/Heart.png.import +++ b/player/Heart.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Heart.png-33902e9ff8206d83f93ea6d088b4a1bc.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Heart_cut Grey.png.import b/player/Heart_cut Grey.png.import index 31c6ef0..be70c9d 100644 --- a/player/Heart_cut Grey.png.import +++ b/player/Heart_cut Grey.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Heart_cut Grey.png-b4b9be15b5a8a36395d31eba43 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Heart_cut.png.import b/player/Heart_cut.png.import index 1646dfd..fdc244b 100644 --- a/player/Heart_cut.png.import +++ b/player/Heart_cut.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Heart_cut.png-f11ef12fc6c55a0077b5ba659ce17ad compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/project.godot b/project.godot index c3e6702..82c7244 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="The Dark Side of Earth" -run/main_scene="uid://cxo6bq26huau7" +run/main_scene="uid://dpkr8yoobtej6" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" diff --git a/world/Background Prototype/Background Prototype Layer 1.png.import b/world/Background Prototype/Background Prototype Layer 1.png.import index 3291c4a..2b3265d 100644 --- a/world/Background Prototype/Background Prototype Layer 1.png.import +++ b/world/Background Prototype/Background Prototype Layer 1.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Background Prototype Layer 1.png-47bb54b6d20a compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/world/Background Prototype/Background Prototype Layer 2.png.import b/world/Background Prototype/Background Prototype Layer 2.png.import index 7415d89..f18ed3b 100644 --- a/world/Background Prototype/Background Prototype Layer 2.png.import +++ b/world/Background Prototype/Background Prototype Layer 2.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Background Prototype Layer 2.png-ab86220f0fff compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/world/Background Prototype/Background Prototype Layer 3.png.import b/world/Background Prototype/Background Prototype Layer 3.png.import index 7399a52..816fbed 100644 --- a/world/Background Prototype/Background Prototype Layer 3.png.import +++ b/world/Background Prototype/Background Prototype Layer 3.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Background Prototype Layer 3.png-5a49ea16a5dc compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/world/Background Prototype/Background Prototype Layer 4.png.import b/world/Background Prototype/Background Prototype Layer 4.png.import index 6ff53ad..b465008 100644 --- a/world/Background Prototype/Background Prototype Layer 4.png.import +++ b/world/Background Prototype/Background Prototype Layer 4.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Background Prototype Layer 4.png-ee5791549e67 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/world/Background prototype.png.import b/world/Background prototype.png.import index c64e0d8..e719aee 100644 --- a/world/Background prototype.png.import +++ b/world/Background prototype.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Background prototype.png-82410769bb8789c49aff compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/world/building_generator.gd b/world/building_generator.gd index 30e9bb9..78813ae 100644 --- a/world/building_generator.gd +++ b/world/building_generator.gd @@ -1,7 +1,8 @@ -extends Node +class_name BuildingGenerator extends Node @onready var grid : Grid = %Earth.get_grid() @export var initial_buildings : int; +@export var initial_spawn_protection = true func random_oppostite_collumn() -> int: var playerpos = %Player.position @@ -19,7 +20,7 @@ func random_collumn() -> int: func _ready(): for i in range(initial_buildings): var collumn = random_collumn() - if 43 <= collumn and collumn <= 49: + if initial_spawn_protection and 43 <= collumn and collumn <= 49: continue var building = randomize_building() grid.add_building_to_collumn(building, collumn) diff --git a/world/earth.tscn b/world/earth.tscn index 98b3618..b0bc2d3 100644 --- a/world/earth.tscn +++ b/world/earth.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=6 format=3 uid="uid://jjoyj1ldafkf"] +[gd_scene load_steps=7 format=3 uid="uid://jjoyj1ldafkf"] +[ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="1_wxnww"] [ext_resource type="Script" uid="uid://b5fhsy1xlreco" path="res://world/draw_circle.gd" id="2_2bhor"] [ext_resource type="Script" uid="uid://m3vyyfk8gnma" path="res://world/grid.gd" id="3_2bhor"] [ext_resource type="PackedScene" uid="uid://djawvtdwp423v" path="res://buildings/building.tscn" id="3_nihcy"] @@ -9,6 +10,7 @@ radius = 3000.0 [node name="Earth" type="Node2D"] +script = ExtResource("1_wxnww") [node name="Ground" type="StaticBody2D" parent="."] From f4ca41ae0986c1a871b22cba19668fedfae8f1ff Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 17 Sep 2025 19:27:06 +0200 Subject: [PATCH 2/4] spam --- buildings/Building 1x2 fixed.png.import | 6 ++++++ buildings/Building 2x1 downside.png.import | 6 ++++++ buildings/Building 2x1 fixed.png.import | 6 ++++++ player/Player_Walk/Walk 1.png.import | 6 ++++++ player/Player_Walk/Walk 2.png.import | 6 ++++++ player/Player_Walk/Walk 3.png.import | 6 ++++++ player/Player_Walk/Walk 4.png.import | 6 ++++++ player/Player_Walk/Walk 5.png.import | 6 ++++++ player/Player_Walk/Walk 6.png.import | 6 ++++++ 9 files changed, 54 insertions(+) diff --git a/buildings/Building 1x2 fixed.png.import b/buildings/Building 1x2 fixed.png.import index 0ac93ca..39a81c9 100644 --- a/buildings/Building 1x2 fixed.png.import +++ b/buildings/Building 1x2 fixed.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Building 1x2 fixed.png-e90afc0d25a8919ada5700 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/buildings/Building 2x1 downside.png.import b/buildings/Building 2x1 downside.png.import index 52d9ce5..0e57d53 100644 --- a/buildings/Building 2x1 downside.png.import +++ b/buildings/Building 2x1 downside.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Building 2x1 downside.png-4b432eb4152bab7dd59 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/buildings/Building 2x1 fixed.png.import b/buildings/Building 2x1 fixed.png.import index a78eae3..e7fdbe6 100644 --- a/buildings/Building 2x1 fixed.png.import +++ b/buildings/Building 2x1 fixed.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Building 2x1 fixed.png-b02748fa52aebae62f987c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 1.png.import b/player/Player_Walk/Walk 1.png.import index 97cf918..7803358 100644 --- a/player/Player_Walk/Walk 1.png.import +++ b/player/Player_Walk/Walk 1.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 1.png-47c623e9d3540b4a00d2bddf52ae0b2a.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 2.png.import b/player/Player_Walk/Walk 2.png.import index 48f18ef..3fac54f 100644 --- a/player/Player_Walk/Walk 2.png.import +++ b/player/Player_Walk/Walk 2.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 2.png-5dea4fdec55fa43e26680e08090fd654.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 3.png.import b/player/Player_Walk/Walk 3.png.import index 285ace3..c65053d 100644 --- a/player/Player_Walk/Walk 3.png.import +++ b/player/Player_Walk/Walk 3.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 3.png-27890c0cb512383b8ecbd848c73efee1.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 4.png.import b/player/Player_Walk/Walk 4.png.import index 03aa90d..c12f6b8 100644 --- a/player/Player_Walk/Walk 4.png.import +++ b/player/Player_Walk/Walk 4.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 4.png-232b1eae2acf3ad82130431014262cde.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 5.png.import b/player/Player_Walk/Walk 5.png.import index fe3ebef..47122be 100644 --- a/player/Player_Walk/Walk 5.png.import +++ b/player/Player_Walk/Walk 5.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 5.png-cfb8eb15ace876127c083283fe74cdc0.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/player/Player_Walk/Walk 6.png.import b/player/Player_Walk/Walk 6.png.import index 22d7868..5b2bdef 100644 --- a/player/Player_Walk/Walk 6.png.import +++ b/player/Player_Walk/Walk 6.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Walk 6.png-f243f98e182be67eb8681a11d34ee554.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false From 4f35cb88f26fc7b2a4952de8c5379c542f48e622 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 17 Sep 2025 19:55:21 +0200 Subject: [PATCH 3/4] Connected the last few buttons. Done with UI! --- death_screen/death_screen.gd | 5 ++-- main_menu/main_menu.gd | 4 ++++ main_menu/main_menu.tscn | 45 +++++++++++++++++++++++++++++++----- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/death_screen/death_screen.gd b/death_screen/death_screen.gd index 8108789..56ba1f5 100644 --- a/death_screen/death_screen.gd +++ b/death_screen/death_screen.gd @@ -4,12 +4,11 @@ func _on_button_quit_pressed() -> void: get_tree().quit() func _on_button_main_menu_pressed() -> void: - print("TODO") - pass # TODO + Engine.time_scale = 1. + get_tree().change_scene_to_file("res://main_menu/main_menu.tscn") func _on_player_player_died() -> void: visible = true - Engine.time_scale = 0.2 diff --git a/main_menu/main_menu.gd b/main_menu/main_menu.gd index d3a81eb..4b423d0 100644 --- a/main_menu/main_menu.gd +++ b/main_menu/main_menu.gd @@ -4,3 +4,7 @@ extends Node func _on_button_start_pressed() -> void: get_tree().change_scene_to_file("res://main.tscn") + + +func _on_button_quit_pressed() -> void: + get_tree().quit() diff --git a/main_menu/main_menu.tscn b/main_menu/main_menu.tscn index e27d15c..faaf5f1 100644 --- a/main_menu/main_menu.tscn +++ b/main_menu/main_menu.tscn @@ -13,11 +13,18 @@ corner_radius_top_right = 350 corner_radius_bottom_right = 350 corner_radius_bottom_left = 350 -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3shxk"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3f7m4"] +draw_center = false +border_color = Color(0.8, 0.8, 0.8, 0) [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bws42"] -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3f7m4"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bws42"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 [node name="main" type="Node"] script = ExtResource("1_bws42") @@ -64,10 +71,36 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_d3a7t") [node name="ButtonStart" type="Button" parent="CanvasLayer/Control/PanelContainer"] layout_mode = 2 theme_type_variation = &"FlatButton" -theme_override_styles/pressed = SubResource("StyleBoxEmpty_3shxk") -theme_override_styles/hover = SubResource("StyleBoxEmpty_bws42") -theme_override_styles/focus = SubResource("StyleBoxEmpty_3f7m4") -text = "Play Again" +theme_override_styles/pressed = SubResource("StyleBoxFlat_3f7m4") +theme_override_styles/focus = SubResource("StyleBoxEmpty_bws42") +text = "PLAY" + +[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -400.0 +offset_top = -100.0 +grow_horizontal = 0 +grow_vertical = 0 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 + +[node name="PanelContainer" type="PanelContainer" parent="CanvasLayer/Control/MarginContainer"] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_bws42") + +[node name="Button_Quit" type="Button" parent="CanvasLayer/Control/MarginContainer/PanelContainer"] +custom_minimum_size = Vector2(400, 100) +layout_mode = 2 +theme_type_variation = &"FlatButton" +text = "Quit Forever" [connection signal="timeout" from="Building Generator/Timer" to="Building Generator" method="_on_timer_timeout"] [connection signal="pressed" from="CanvasLayer/Control/PanelContainer/ButtonStart" to="." method="_on_button_start_pressed"] +[connection signal="pressed" from="CanvasLayer/Control/MarginContainer/PanelContainer/Button_Quit" to="." method="_on_button_quit_pressed"] From e5e54a712761d1777b9476c7bf6f915612fadee2 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 17 Sep 2025 23:43:52 +0200 Subject: [PATCH 4/4] More room layouts and fixed unique items --- buildings/room_bear_trap.tscn | 66 ++++++++++++++++++ ...ted_house.tscn => room_haunted_house.tscn} | 0 buildings/room_pedastal.tscn | 66 ++++++++++++++++++ buildings/room_pedastal_mean.tscn | 58 ++++++++++++++++ buildings/{building.tscn => room_temple.tscn} | 0 buildings/room_wide_item_above.tscn | 67 +++++++++++++++++++ items/generic/item_spawn.gd | 7 +- items/generic/item_spawn.tscn | 7 +- items/permanent_items/backslash.tscn | 2 +- main.tscn | 2 +- traps/bear_trap.gd | 22 ++++++ traps/bear_trap.gd.uid | 1 + traps/bear_trap.tscn | 32 +++++++++ world/earth.tscn | 12 ++-- 14 files changed, 330 insertions(+), 12 deletions(-) create mode 100644 buildings/room_bear_trap.tscn rename buildings/{haunted_house.tscn => room_haunted_house.tscn} (100%) create mode 100644 buildings/room_pedastal.tscn create mode 100644 buildings/room_pedastal_mean.tscn rename buildings/{building.tscn => room_temple.tscn} (100%) create mode 100644 buildings/room_wide_item_above.tscn create mode 100644 traps/bear_trap.gd create mode 100644 traps/bear_trap.gd.uid create mode 100644 traps/bear_trap.tscn diff --git a/buildings/room_bear_trap.tscn b/buildings/room_bear_trap.tscn new file mode 100644 index 0000000..5ecb49c --- /dev/null +++ b/buildings/room_bear_trap.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=10 format=3 uid="uid://dliwqqmrxldjh"] + +[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_c7qov"] +[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_6a6ii"] +[ext_resource type="Texture2D" uid="uid://dfy0gccqgggp2" path="res://buildings/Building 2x1 fixed.png" id="3_ihg0a"] +[ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_505qw"] +[ext_resource type="Texture2D" uid="uid://3weywjfsapax" path="res://buildings/Building 2x1 downside.png" id="5_012sa"] +[ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="6_qwyfo"] +[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="8_evf2t"] +[ext_resource type="PackedScene" uid="uid://h3caql0b6vft" path="res://traps/bear_trap.tscn" id="9_c7qov"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_pfkkr"] +shader = ExtResource("2_6a6ii") +shader_parameter/ground_height = 3000.0 +shader_parameter/cell_height = 300.0 +shader_parameter/num_cells = 60 + +[node name="Building2" type="Node2D"] +script = ExtResource("1_c7qov") + +[node name="Sprite2D" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_pfkkr") +scale = Vector2(25, 25) +texture = ExtResource("3_ihg0a") +script = ExtResource("4_505qw") + +[node name="Sprite2D2" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_pfkkr") +scale = Vector2(25, 25) +texture = ExtResource("5_012sa") +script = ExtResource("4_505qw") +grid_offset = Vector2i(0, -1) + +[node name="EnemyList" type="Node2D" parent="."] + +[node name="MorningStar" parent="EnemyList" instance=ExtResource("6_qwyfo")] +position = Vector2(238, -149) + +[node name="Platform" parent="EnemyList" instance=ExtResource("8_evf2t")] +visible = false +position = Vector2(75, -285) + +[node name="Platform2" parent="EnemyList" instance=ExtResource("8_evf2t")] +visible = false +position = Vector2(225, -285) + +[node name="Platform3" parent="EnemyList" instance=ExtResource("8_evf2t")] +visible = false +position = Vector2(375, -285) + +[node name="Platform4" parent="EnemyList" instance=ExtResource("8_evf2t")] +visible = false +position = Vector2(525, -285) + +[node name="Platform5" parent="EnemyList" instance=ExtResource("8_evf2t")] +position = Vector2(431, -150) +scale = Vector2(2.688, 3) + +[node name="BearTrap" parent="EnemyList" instance=ExtResource("9_c7qov")] +position = Vector2(270, -9) + +[node name="DebugSprite" type="Sprite2D" parent="."] +visible = false +position = Vector2(300, -150) +scale = Vector2(1.172, 1.172) +texture = ExtResource("3_ihg0a") diff --git a/buildings/haunted_house.tscn b/buildings/room_haunted_house.tscn similarity index 100% rename from buildings/haunted_house.tscn rename to buildings/room_haunted_house.tscn diff --git a/buildings/room_pedastal.tscn b/buildings/room_pedastal.tscn new file mode 100644 index 0000000..70ccdfa --- /dev/null +++ b/buildings/room_pedastal.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=10 format=3 uid="uid://6y637jp2tbma"] + +[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_w5m4l"] +[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_wod1l"] +[ext_resource type="Texture2D" uid="uid://djir4ehm8kif" path="res://buildings/Building 1x2 fixed.png" id="3_elmbw"] +[ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_1cnhw"] +[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="5_rh5oo"] +[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="6_caaff"] +[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/generic/item_spawn.tscn" id="7_elmbw"] +[ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="8_1cnhw"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_qnfc1"] +resource_local_to_scene = true +shader = ExtResource("2_wod1l") +shader_parameter/ground_height = 3000.0 +shader_parameter/cell_height = 300.0 +shader_parameter/num_cells = 60 + +[node name="Building" type="Node2D"] +script = ExtResource("1_w5m4l") +dimension = Vector2i(1, 2) + +[node name="Sprite2D" type="Sprite2D" parent="."] +self_modulate = Color(0.176471, 0, 0.00392157, 0.00392157) +material = SubResource("ShaderMaterial_qnfc1") +scale = Vector2(25, 25) +texture = ExtResource("3_elmbw") +script = ExtResource("4_1cnhw") + +[node name="EnemyList" type="Node2D" parent="."] + +[node name="Ghost" parent="EnemyList" instance=ExtResource("5_rh5oo")] +position = Vector2(-37.99997, -481) + +[node name="Platform" parent="EnemyList" instance=ExtResource("6_caaff")] +visible = false +position = Vector2(75, -585) + +[node name="Platform2" parent="EnemyList" instance=ExtResource("6_caaff")] +visible = false +position = Vector2(225, -585) + +[node name="Platform3" parent="EnemyList" instance=ExtResource("6_caaff")] +position = Vector2(5, -251.00003) + +[node name="Platform4" parent="EnemyList" instance=ExtResource("6_caaff")] +position = Vector2(286, -138.00002) + +[node name="Platform5" parent="EnemyList" instance=ExtResource("6_caaff")] +position = Vector2(269.0001, -435) +scale = Vector2(2.49, 3.1) + +[node name="ItemSpawn" parent="EnemyList" instance=ExtResource("7_elmbw")] +position = Vector2(149, -645) + +[node name="MorningStar" parent="EnemyList" instance=ExtResource("8_1cnhw")] +position = Vector2(39, -552) + +[node name="Ghost2" parent="EnemyList" instance=ExtResource("5_rh5oo")] +position = Vector2(301, -39) + +[node name="DebugSprite" type="Sprite2D" parent="."] +visible = false +position = Vector2(150, -300) +scale = Vector2(1.172, 1.172) +texture = ExtResource("3_elmbw") diff --git a/buildings/room_pedastal_mean.tscn b/buildings/room_pedastal_mean.tscn new file mode 100644 index 0000000..bf61e77 --- /dev/null +++ b/buildings/room_pedastal_mean.tscn @@ -0,0 +1,58 @@ +[gd_scene load_steps=10 format=3 uid="uid://dt827qxyycg8n"] + +[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_pww4b"] +[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_qsju2"] +[ext_resource type="Texture2D" uid="uid://djir4ehm8kif" path="res://buildings/Building 1x2 fixed.png" id="3_0yjll"] +[ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_ri5b7"] +[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="6_kom4b"] +[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/generic/item_spawn.tscn" id="7_sr858"] +[ext_resource type="PackedScene" uid="uid://h3caql0b6vft" path="res://traps/bear_trap.tscn" id="8_pww4b"] +[ext_resource type="PackedScene" uid="uid://dpv1w56yr1xue" path="res://traps/morning_star.tscn" id="8_ta0fd"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_qnfc1"] +resource_local_to_scene = true +shader = ExtResource("2_qsju2") +shader_parameter/ground_height = 3000.0 +shader_parameter/cell_height = 300.0 +shader_parameter/num_cells = 60 + +[node name="Building" type="Node2D"] +script = ExtResource("1_pww4b") +dimension = Vector2i(1, 2) + +[node name="Sprite2D" type="Sprite2D" parent="."] +self_modulate = Color(0.176471, 0, 0.00392157, 0.00392157) +material = SubResource("ShaderMaterial_qnfc1") +scale = Vector2(25, 25) +texture = ExtResource("3_0yjll") +script = ExtResource("4_ri5b7") + +[node name="EnemyList" type="Node2D" parent="."] + +[node name="Platform" parent="EnemyList" instance=ExtResource("6_kom4b")] +visible = false +position = Vector2(75, -585) + +[node name="Platform2" parent="EnemyList" instance=ExtResource("6_kom4b")] +visible = false +position = Vector2(225, -585) + +[node name="Platform5" parent="EnemyList" instance=ExtResource("6_kom4b")] +position = Vector2(85.000015, -287) +scale = Vector2(2.49, 3.1) + +[node name="ItemSpawn" parent="EnemyList" instance=ExtResource("7_sr858")] +position = Vector2(149, -645) +rarity_bonus = 2 + +[node name="MorningStar" parent="EnemyList" instance=ExtResource("8_ta0fd")] +position = Vector2(39, -552) + +[node name="BearTrap" parent="EnemyList" instance=ExtResource("8_pww4b")] +position = Vector2(165, -7) + +[node name="DebugSprite" type="Sprite2D" parent="."] +visible = false +position = Vector2(150, -300) +scale = Vector2(1.172, 1.172) +texture = ExtResource("3_0yjll") diff --git a/buildings/building.tscn b/buildings/room_temple.tscn similarity index 100% rename from buildings/building.tscn rename to buildings/room_temple.tscn diff --git a/buildings/room_wide_item_above.tscn b/buildings/room_wide_item_above.tscn new file mode 100644 index 0000000..d72155d --- /dev/null +++ b/buildings/room_wide_item_above.tscn @@ -0,0 +1,67 @@ +[gd_scene load_steps=11 format=3 uid="uid://c7ddsyd8kcjji"] + +[ext_resource type="Script" uid="uid://b2ji03ekijjnn" path="res://buildings/building.gd" id="1_0710n"] +[ext_resource type="Shader" uid="uid://c7gb1nqwvkr37" path="res://buildings/building.gdshader" id="2_7e5ul"] +[ext_resource type="Texture2D" uid="uid://dfy0gccqgggp2" path="res://buildings/Building 2x1 fixed.png" id="3_lxvry"] +[ext_resource type="Script" uid="uid://dj7d4d2xs3nci" path="res://buildings/building_mesh.gd" id="4_h84o2"] +[ext_resource type="Texture2D" uid="uid://3weywjfsapax" path="res://buildings/Building 2x1 downside.png" id="5_v4fh6"] +[ext_resource type="PackedScene" uid="uid://4l3elvxpghw8" path="res://utils/platform.tscn" id="6_me65q"] +[ext_resource type="PackedScene" uid="uid://xj0of571aur1" path="res://items/generic/item_spawn.tscn" id="7_crruu"] +[ext_resource type="PackedScene" uid="uid://h3caql0b6vft" path="res://traps/bear_trap.tscn" id="8_fkxmk"] +[ext_resource type="PackedScene" uid="uid://chu67ci7sl488" path="res://enemies/ghost.tscn" id="9_6hrl3"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_pfkkr"] +shader = ExtResource("2_7e5ul") +shader_parameter/ground_height = 3000.0 +shader_parameter/cell_height = 300.0 +shader_parameter/num_cells = 60 + +[node name="Building2" type="Node2D"] +script = ExtResource("1_0710n") + +[node name="Sprite2D" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_pfkkr") +scale = Vector2(25, 25) +texture = ExtResource("3_lxvry") +script = ExtResource("4_h84o2") + +[node name="Sprite2D2" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_pfkkr") +scale = Vector2(25, 25) +texture = ExtResource("5_v4fh6") +script = ExtResource("4_h84o2") +grid_offset = Vector2i(0, -1) + +[node name="EnemyList" type="Node2D" parent="."] + +[node name="Platform" parent="EnemyList" instance=ExtResource("6_me65q")] +visible = false +position = Vector2(75, -285) + +[node name="Platform2" parent="EnemyList" instance=ExtResource("6_me65q")] +visible = false +position = Vector2(225, -285) + +[node name="Platform3" parent="EnemyList" instance=ExtResource("6_me65q")] +visible = false +position = Vector2(375, -285) + +[node name="Platform4" parent="EnemyList" instance=ExtResource("6_me65q")] +visible = false +position = Vector2(525, -285) + +[node name="ItemSpawn" parent="EnemyList" instance=ExtResource("7_crruu")] +position = Vector2(137, -329) +rarity_bonus = 1 + +[node name="BearTrap" parent="EnemyList" instance=ExtResource("8_fkxmk")] +position = Vector2(465, -301) + +[node name="Ghost" parent="EnemyList" instance=ExtResource("9_6hrl3")] +position = Vector2(301, -49) + +[node name="DebugSprite" type="Sprite2D" parent="."] +visible = false +position = Vector2(300, -150) +scale = Vector2(1.172, 1.172) +texture = ExtResource("3_lxvry") diff --git a/items/generic/item_spawn.gd b/items/generic/item_spawn.gd index a9d6e88..72c3c76 100644 --- a/items/generic/item_spawn.gd +++ b/items/generic/item_spawn.gd @@ -2,7 +2,9 @@ class_name ItemSpawn extends Node2D @export var common_items : Array[PackedScene] @export var rare_items : Array[PackedScene] -@export var unique_items : Array[PackedScene] +static var unique_items : Array[PackedScene] = [ + load("res://items/permanent_items/backslash.tscn") +] @export var rarity_bonus = 0 @export var guarantee_rare : bool = false @@ -24,7 +26,6 @@ func choose_pool() -> Array[PackedScene]: return unique_items elif random < unique_chance + rare_chance || guarantee_rare: return rare_items - return common_items func _ready(): @@ -32,7 +33,7 @@ func _ready(): var index = randi_range(0, pool.size() - 1) var packed_scene : PackedScene = pool[index] if remove_after_spawn: - pool.remove_at(index) + unique_items.remove_at(index) var object = packed_scene.instantiate() add_child.call_deferred(object) object.reparent.call_deferred(get_parent()) diff --git a/items/generic/item_spawn.tscn b/items/generic/item_spawn.tscn index db31386..969ae9d 100644 --- a/items/generic/item_spawn.tscn +++ b/items/generic/item_spawn.tscn @@ -9,9 +9,10 @@ [node name="ItemSpawn" type="Node2D"] script = ExtResource("1_ms6tn") -common_items = Array[PackedScene]([ExtResource("2_w6i8k"), ExtResource("3_yi7ag"), ExtResource("5_uitgx"), ExtResource("4_v0ua0")]) -rare_items = Array[PackedScene]([ExtResource("4_v0ua0")]) -unique_items = Array[PackedScene]([ExtResource("5_uitgx")]) +common_items = Array[PackedScene]([ExtResource("2_w6i8k")]) +rare_items = Array[PackedScene]([ExtResource("4_v0ua0"), ExtResource("5_uitgx"), ExtResource("3_yi7ag")]) +unique_base_chance = 0.1 +rare_base_chance = 0.3 metadata/_custom_type_script = "uid://b8em61mqgdi58" [node name="EarthAligner" parent="." instance=ExtResource("3_5pwuf")] diff --git a/items/permanent_items/backslash.tscn b/items/permanent_items/backslash.tscn index 79634f3..ff66420 100644 --- a/items/permanent_items/backslash.tscn +++ b/items/permanent_items/backslash.tscn @@ -19,5 +19,5 @@ scale = Vector2(7, 7) shape = SubResource("CircleShape2D_hvhjo") [node name="Sprite2D" type="Sprite2D" parent="."] -modulate = Color(1, 1, 0, 1) +modulate = Color(0.6862745, 0.16078432, 0.5294118, 1) texture = ExtResource("3_vb0oa") diff --git a/main.tscn b/main.tscn index 46c7d90..92ba5b6 100644 --- a/main.tscn +++ b/main.tscn @@ -15,7 +15,7 @@ unique_name_in_owner = true [node name="Player" parent="." instance=ExtResource("2_1bvp3")] unique_name_in_owner = true -position = Vector2(500, -3100) +position = Vector2(709, -2980) scale = Vector2(3, 3) [node name="Camera2D" type="Camera2D" parent="Player"] diff --git a/traps/bear_trap.gd b/traps/bear_trap.gd new file mode 100644 index 0000000..ffdc37a --- /dev/null +++ b/traps/bear_trap.gd @@ -0,0 +1,22 @@ +extends Node2D + +@export var player_damage : int; +@export var enemy_damage : int; + + + +func damage_target(target: CollisionObject2D): + if(target.get_collision_layer_value(3)): + target.hurt(player_damage, Vector2.ZERO) + else: + target.hurt(enemy_damage, Vector2.ZERO) + + +func _on_area_2d_area_entered(area: Area2D) -> void: + damage_target(area) + queue_free() + + +func _on_area_2d_body_entered(body: Node2D) -> void: + damage_target(body) + queue_free() diff --git a/traps/bear_trap.gd.uid b/traps/bear_trap.gd.uid new file mode 100644 index 0000000..280d623 --- /dev/null +++ b/traps/bear_trap.gd.uid @@ -0,0 +1 @@ +uid://dttgoqksqnsm0 diff --git a/traps/bear_trap.tscn b/traps/bear_trap.tscn new file mode 100644 index 0000000..c48e204 --- /dev/null +++ b/traps/bear_trap.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=5 format=3 uid="uid://h3caql0b6vft"] + +[ext_resource type="Script" uid="uid://dttgoqksqnsm0" path="res://traps/bear_trap.gd" id="1_u48ys"] +[ext_resource type="Texture2D" uid="uid://cy70quh6k3s1j" path="res://icon.svg" id="2_mnxjq"] +[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_mnxjq"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_yh007"] +radius = 30.0 + +[node name="BearTrap" type="Node2D"] +script = ExtResource("1_u48ys") +player_damage = 2 +enemy_damage = 50 + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 6 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +position = Vector2(0, -15) +scale = Vector2(1, 0.5) +shape = SubResource("CircleShape2D_yh007") + +[node name="Sprite2D" type="Sprite2D" parent="."] +self_modulate = Color(1, 0, 0, 1) +scale = Vector2(0.75, 0.1) +texture = ExtResource("2_mnxjq") + +[node name="EarthAligner" parent="." instance=ExtResource("3_mnxjq")] + +[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"] +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/world/earth.tscn b/world/earth.tscn index b0bc2d3..bb1d385 100644 --- a/world/earth.tscn +++ b/world/earth.tscn @@ -1,10 +1,14 @@ -[gd_scene load_steps=7 format=3 uid="uid://jjoyj1ldafkf"] +[gd_scene load_steps=11 format=3 uid="uid://jjoyj1ldafkf"] [ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="1_wxnww"] [ext_resource type="Script" uid="uid://b5fhsy1xlreco" path="res://world/draw_circle.gd" id="2_2bhor"] [ext_resource type="Script" uid="uid://m3vyyfk8gnma" path="res://world/grid.gd" id="3_2bhor"] -[ext_resource type="PackedScene" uid="uid://djawvtdwp423v" path="res://buildings/building.tscn" id="3_nihcy"] -[ext_resource type="PackedScene" uid="uid://cmofmd0vf3hx3" path="res://buildings/haunted_house.tscn" id="4_ml5no"] +[ext_resource type="PackedScene" uid="uid://djawvtdwp423v" path="res://buildings/room_temple.tscn" id="3_nihcy"] +[ext_resource type="PackedScene" uid="uid://cmofmd0vf3hx3" path="res://buildings/room_haunted_house.tscn" id="4_ml5no"] +[ext_resource type="PackedScene" uid="uid://dliwqqmrxldjh" path="res://buildings/room_bear_trap.tscn" id="4_r4pw8"] +[ext_resource type="PackedScene" uid="uid://6y637jp2tbma" path="res://buildings/room_pedastal.tscn" id="6_640fc"] +[ext_resource type="PackedScene" uid="uid://dt827qxyycg8n" path="res://buildings/room_pedastal_mean.tscn" id="7_abvrx"] +[ext_resource type="PackedScene" uid="uid://c7ddsyd8kcjji" path="res://buildings/room_wide_item_above.tscn" id="9_ej0af"] [sub_resource type="CircleShape2D" id="CircleShape2D_5i67w"] radius = 3000.0 @@ -27,5 +31,5 @@ script = ExtResource("3_2bhor") ground_radius = 3000.0 cell_height = 300.0 num_collumns = 60 -packed_buildings = Array[PackedScene]([ExtResource("3_nihcy"), ExtResource("4_ml5no")]) +packed_buildings = Array[PackedScene]([ExtResource("4_r4pw8"), ExtResource("4_ml5no"), ExtResource("6_640fc"), ExtResource("7_abvrx"), ExtResource("3_nihcy"), ExtResource("9_ej0af")]) metadata/_custom_type_script = "uid://m3vyyfk8gnma"