From 36666f4e78ca0225fdd63a13c2905b41d52ee57d Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Thu, 18 Sep 2025 18:30:14 +0200 Subject: [PATCH 1/2] Boss in Main Scene Fixed --- main.tscn | 11 +++++++---- project.godot | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/main.tscn b/main.tscn index f17786e..31c101e 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://cxo6bq26huau7"] +[gd_scene load_steps=12 format=3 uid="uid://cxo6bq26huau7"] [ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"] [ext_resource type="Texture2D" uid="uid://d3fpq76anm4t7" path="res://world/Background Prototype/Background prototype.png" id="3_kek77"] @@ -10,6 +10,7 @@ [ext_resource type="Script" uid="uid://3k6r3jnko4hg" path="res://show_fps.gd" id="8_5vw27"] [ext_resource type="PackedScene" uid="uid://b62xcg0dd3vct" path="res://enemies/leech.tscn" id="9_kek77"] [ext_resource type="PackedScene" uid="uid://ca5ndobertnp4" path="res://water/water.tscn" id="10_4c57u"] +[ext_resource type="PackedScene" uid="uid://cpe4s6vsn0ujd" path="res://boss.tscn" id="11_efxa6"] [node name="main" type="Node2D"] @@ -68,16 +69,15 @@ script = ExtResource("8_5vw27") [node name="Leech" parent="." instance=ExtResource("9_kek77")] position = Vector2(0, -3015) -[node name="Boss" parent="." instance=ExtResource("10_4c57u")] -position = Vector2(0, -3500) - [node name="Water" parent="." instance=ExtResource("10_4c57u")] z_index = 15 [node name="CanvasLayer-1" type="CanvasLayer" parent="."] layer = -1 +visible = false [node name="ColorRect" type="TextureRect" parent="CanvasLayer-1"] +visible = false anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -85,6 +85,9 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("3_kek77") +[node name="Boss" parent="." instance=ExtResource("11_efxa6")] +position = Vector2(0, -3500) + [connection signal="active_item_changed" from="Player" to="CanvasLayer1/ItemUI" method="_on_player_active_item_changed"] [connection signal="health_changed" from="Player" to="CanvasLayer1/Healthbar" method="_on_player_health_changed"] [connection signal="max_hp_changed" from="Player" to="CanvasLayer1/Healthbar" method="_on_player_max_hp_changed"] diff --git a/project.godot b/project.godot index 73df7ee..74ca773 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="The Dark Side of Earth" run/main_scene="uid://cxo6bq26huau7" -config/features=PackedStringArray("4.4", "Forward Plus") +config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" [display] From 85eee00790f205e0297a85fc90ad09dbee509f16 Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Thu, 18 Sep 2025 20:09:53 +0200 Subject: [PATCH 2/2] Added splash attack --- blob.gd | 26 ++++++++++++++++++++++++++ blob.gd.uid | 1 + blob_big.gd | 32 ++++++++++++++++++++++++++++++++ blob_big.gd.uid | 1 + blob_big.tscn | 19 +++++++++++++++++++ blob_small.tscn | 37 +++++++++++++++++++++++++++++++++++++ boss.gd | 7 ++++++- boss.tscn | 4 +++- bubble.png | Bin 0 -> 1876 bytes bubble.png.import | 40 ++++++++++++++++++++++++++++++++++++++++ project.godot | 2 +- 11 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 blob.gd create mode 100644 blob.gd.uid create mode 100644 blob_big.gd create mode 100644 blob_big.gd.uid create mode 100644 blob_big.tscn create mode 100644 blob_small.tscn create mode 100644 bubble.png create mode 100644 bubble.png.import diff --git a/blob.gd b/blob.gd new file mode 100644 index 0000000..7b3c037 --- /dev/null +++ b/blob.gd @@ -0,0 +1,26 @@ +extends Node2D + + +var moving = false +@onready var player = get_tree().get_root().get_node("main/Player") +@onready var target = player.position +var speed = 500 + +var reached = false +signal target_reached + +func _ready() -> void: + await get_tree().create_timer(1).timeout + moving = true + +func _physics_process(delta: float) -> void: + if moving: + position += (target - global_position).normalized().rotated(-get_parent().rotation) * speed * delta + if((global_position - target).length() < 40): + moving = false + if not reached: + target_reached.emit() + reached = true + if has_node("Area2D") and $Area2D.overlaps_body(player): + player.hurt(1, global_position-player.position) + diff --git a/blob.gd.uid b/blob.gd.uid new file mode 100644 index 0000000..12ff93a --- /dev/null +++ b/blob.gd.uid @@ -0,0 +1 @@ +uid://d4n32kt7t726k diff --git a/blob_big.gd b/blob_big.gd new file mode 100644 index 0000000..e28f162 --- /dev/null +++ b/blob_big.gd @@ -0,0 +1,32 @@ +extends Node2D +@onready var player = get_tree().get_root().get_node("main/Player") +var speed = 200 +var angular_speed = TAU/8 +var lifetime = 5 + +var ready_blobs = 0 +var num_blobs = 4 + +var particles_ended = false + +func _on_target_reached(): + ready_blobs += 1 + +func _ready() -> void: + for child in get_children(): + if "target_reached" in child: + child.connect("target_reached", _on_target_reached) + +func _physics_process(delta: float) -> void: + if ready_blobs == num_blobs: + position += (player.position - position).normalized() * speed * delta + rotate(angular_speed * delta) + lifetime -= delta + if lifetime < 0 and not particles_ended: + particles_ended = true + for child in get_children(): + if "target_reached" in child: + child.get_node("GPUParticles2D").emitting = false + child.get_node("Area2D").queue_free() + if lifetime < -2: + queue_free() diff --git a/blob_big.gd.uid b/blob_big.gd.uid new file mode 100644 index 0000000..53fb41a --- /dev/null +++ b/blob_big.gd.uid @@ -0,0 +1 @@ +uid://b22hbgn80m4l0 diff --git a/blob_big.tscn b/blob_big.tscn new file mode 100644 index 0000000..76f1546 --- /dev/null +++ b/blob_big.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=3 format=3 uid="uid://bg2hgia0jqnqf"] + +[ext_resource type="Script" uid="uid://b22hbgn80m4l0" path="res://blob_big.gd" id="1_xkk63"] +[ext_resource type="PackedScene" uid="uid://ck0bj7444wfsl" path="res://blob_small.tscn" id="2_jl75s"] + +[node name="blob_big" type="Node2D"] +script = ExtResource("1_xkk63") + +[node name="Blob" parent="." instance=ExtResource("2_jl75s")] +position = Vector2(400, 0) + +[node name="Blob2" parent="." instance=ExtResource("2_jl75s")] +position = Vector2(-400, 0) + +[node name="Blob3" parent="." instance=ExtResource("2_jl75s")] +position = Vector2(0, -400) + +[node name="Blob4" parent="." instance=ExtResource("2_jl75s")] +position = Vector2(0, 400) diff --git a/blob_small.tscn b/blob_small.tscn new file mode 100644 index 0000000..d6fe127 --- /dev/null +++ b/blob_small.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=3 uid="uid://ck0bj7444wfsl"] + +[ext_resource type="Script" uid="uid://d4n32kt7t726k" path="res://blob.gd" id="1_wigkh"] +[ext_resource type="Texture2D" uid="uid://dvlvu37up72gt" path="res://bubble.png" id="2_jle3w"] + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_aaw6g"] +particle_flag_disable_z = true +emission_shape = 1 +emission_sphere_radius = 53.96 +angular_velocity_min = -1.60933e-05 +angular_velocity_max = -1.60933e-05 +orbit_velocity_min = 0.184 +orbit_velocity_max = 0.184 +radial_velocity_min = 91.95 +radial_velocity_max = 160.92 +gravity = Vector3(0, 0, 0) + +[sub_resource type="CircleShape2D" id="CircleShape2D_i5m1y"] +radius = 45.0 + +[node name="Blob" type="Node2D"] +script = ExtResource("1_wigkh") + +[node name="GPUParticles2D" type="GPUParticles2D" parent="."] +amount = 100 +texture = ExtResource("2_jle3w") +lifetime = 0.1 +speed_scale = 0.3 +fixed_fps = 60 +process_material = SubResource("ParticleProcessMaterial_aaw6g") + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("CircleShape2D_i5m1y") diff --git a/boss.gd b/boss.gd index f5fb3e3..645a86c 100644 --- a/boss.gd +++ b/boss.gd @@ -3,6 +3,7 @@ extends CharacterBody2D @onready var player = get_tree().get_root().get_node("main/Player") var moves = ["slam", "wave", "water_rise", "splash"] @onready var next_move = choose_next_move() +@export var big_blob : PackedScene var risen = 0 var attack_ready = true @@ -80,5 +81,9 @@ func water_rise(): attack_ready = true func splash(): - await get_tree().create_timer(4).timeout + var blob_instance = big_blob.instantiate() + get_tree().get_root().add_child(blob_instance) + blob_instance.position = player.position + blob_instance.rotation = randf_range(0, TAU) + await get_tree().create_timer(5).timeout attack_ready = true diff --git a/boss.tscn b/boss.tscn index 4fca3b4..a52ad11 100644 --- a/boss.tscn +++ b/boss.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 format=3 uid="uid://cpe4s6vsn0ujd"] +[gd_scene load_steps=8 format=3 uid="uid://cpe4s6vsn0ujd"] [ext_resource type="Texture2D" uid="uid://d3b5hmhjw2jyc" path="res://enemies/ghost animation/Ghost 1.png" id="1_6xxrv"] [ext_resource type="Script" uid="uid://uv672p8f4n6k" path="res://boss.gd" id="1_skx2t"] +[ext_resource type="PackedScene" uid="uid://bg2hgia0jqnqf" path="res://blob_big.tscn" id="2_o1i15"] [ext_resource type="PackedScene" uid="uid://mtfsdd4cdf3a" path="res://utils/enemy_hurtbox.tscn" id="2_skx2t"] [ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="4_lnbgr"] @@ -13,6 +14,7 @@ size = Vector2(300, 250) [node name="Boss" type="CharacterBody2D"] collision_mask = 32 script = ExtResource("1_skx2t") +big_blob = ExtResource("2_o1i15") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 1.5708 diff --git a/bubble.png b/bubble.png new file mode 100644 index 0000000000000000000000000000000000000000..7a3cb68c8740027f16530768a1158599faf65938 GIT binary patch literal 1876 zcmV-a2dnsrP)EX>4Tx04R}tkv&MmKpe$iQ>7{uzdDFGWT;MdQ4z;l zg(6f4wL+^7CYOFelZK?l#ZhoAIQX$xb#QUk)xlK|1V2FB1t&!pDe-?vp+$@b$NhMB z?{W7I5b7nSSshV8(<^2&9uw1JWWz0!Z0-odR9zMR_MR=C?xj#p* znzb0<6N#hDFe}6x#50=}gY!Odh!td&_?&pcqze*1a$RxxjdR{%foF!yRC1m;L@egp zSZQNcFg4<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