diff --git a/assets/acid_slug/dead.png b/assets/acid_slug/dead.png new file mode 100644 index 0000000..088f29f Binary files /dev/null and b/assets/acid_slug/dead.png differ diff --git a/assets/acid_slug/dead.png.import b/assets/acid_slug/dead.png.import new file mode 100644 index 0000000..6c8bbdf --- /dev/null +++ b/assets/acid_slug/dead.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://kukhycmvn8jm" +path="res://.godot/imported/dead.png-6582490a0f80038448f4a2fb17399760.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/acid_slug/dead.png" +dest_files=["res://.godot/imported/dead.png-6582490a0f80038448f4a2fb17399760.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/acid_slug/dead.xcf b/assets/acid_slug/dead.xcf new file mode 100644 index 0000000..04a7a55 Binary files /dev/null and b/assets/acid_slug/dead.xcf differ diff --git a/assets/lava_ant/dead.png b/assets/lava_ant/dead.png new file mode 100644 index 0000000..cefde6f Binary files /dev/null and b/assets/lava_ant/dead.png differ diff --git a/assets/lava_ant/dead.png.import b/assets/lava_ant/dead.png.import new file mode 100644 index 0000000..c5298e0 --- /dev/null +++ b/assets/lava_ant/dead.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwx70ehs7yhd5" +path="res://.godot/imported/dead.png-40bdc3501c81304eba7f83b0de69eff2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/lava_ant/dead.png" +dest_files=["res://.godot/imported/dead.png-40bdc3501c81304eba7f83b0de69eff2.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/lava_ant/dead.xcf b/assets/lava_ant/dead.xcf new file mode 100644 index 0000000..af7c356 Binary files /dev/null and b/assets/lava_ant/dead.xcf differ diff --git a/scenes/enemies/acid_slug.tscn b/scenes/enemies/acid_slug.tscn index 82c59ac..838a8e2 100644 --- a/scenes/enemies/acid_slug.tscn +++ b/scenes/enemies/acid_slug.tscn @@ -30,6 +30,7 @@ animations = [{ script = ExtResource("2_0y44s") idle_speed = 75 pursuit_speed = 100 +enemy_name = "acid slug" health = 15 [node name="AnimatedSprite2D" parent="." index="2"] diff --git a/scenes/enemies/acid_slug_corpse.tscn b/scenes/enemies/acid_slug_corpse.tscn new file mode 100644 index 0000000..72332bc --- /dev/null +++ b/scenes/enemies/acid_slug_corpse.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://8adnlirnllrd"] + +[ext_resource type="Texture2D" uid="uid://kukhycmvn8jm" path="res://assets/acid_slug/dead.png" id="1_64ysi"] + +[node name="AcidSlugCorpse" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +z_index = 5 +texture = ExtResource("1_64ysi") diff --git a/scenes/enemies/enemy.gd b/scenes/enemies/enemy.gd index ae23084..20a276d 100644 --- a/scenes/enemies/enemy.gd +++ b/scenes/enemies/enemy.gd @@ -10,6 +10,7 @@ class_name Enemy @export var idle_speed: int = 150 @export var pursuit_speed: int = 300 +@export var enemy_name: String = "enemy" var collision_tilemap: TileMapLayer var speed: int = 0 var vulnerable: bool = true @@ -38,7 +39,7 @@ func _ready() -> void: # scaling #scale = Vector2(scaling, scaling) animated_sprite_2d.scale = Vector2(scaling, scaling) - $AttackArea2D.scale = Vector2(scaling, scaling) * 1.25 + $AttackArea2D.scale *= Vector2(scaling, scaling) idle_speed += ((1 - scaling) * 1.5) * idle_speed pursuit_speed += ((1 - scaling) * 1.5) * pursuit_speed if scaling > 0.75: @@ -122,6 +123,7 @@ func switch_state(state_enum) -> void: state = DEAD speed = 0 navigating = false + Globals.signal_enemy_died(enemy_name, position, scaling) queue_free() func _on_navigation_agent_2d_target_reached() -> void: diff --git a/scenes/enemies/lava_ant.gd b/scenes/enemies/lava_ant.gd index e938c41..7a9c355 100644 --- a/scenes/enemies/lava_ant.gd +++ b/scenes/enemies/lava_ant.gd @@ -40,6 +40,7 @@ func summon_lava_aoe(): func _on_animated_sprite_2d_animation_finished() -> void: if animated_sprite_2d.animation == "explode": summon_lava_aoe() + Globals.signal_enemy_died(enemy_name, position, scaling) queue_free() func switch_state(state_enum) -> void: diff --git a/scenes/enemies/lava_ant.tscn b/scenes/enemies/lava_ant.tscn index b778822..5dbebcd 100644 --- a/scenes/enemies/lava_ant.tscn +++ b/scenes/enemies/lava_ant.tscn @@ -144,6 +144,7 @@ z_index = 5 collision_layer = 2 collision_mask = 12 script = ExtResource("1_1ih35") +enemy_name = "lava ant" [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_ey3sv") diff --git a/scenes/enemies/lava_ant_corpse.tscn b/scenes/enemies/lava_ant_corpse.tscn new file mode 100644 index 0000000..6362152 --- /dev/null +++ b/scenes/enemies/lava_ant_corpse.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://dl7j6lw28a6qo"] + +[ext_resource type="Texture2D" uid="uid://dwx70ehs7yhd5" path="res://assets/lava_ant/dead.png" id="1_pdcod"] + +[node name="LavaAntCorpse" type="Node2D"] +z_index = 5 + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_pdcod") diff --git a/scenes/globals.gd b/scenes/globals.gd index 94cf789..00d8ebb 100644 --- a/scenes/globals.gd +++ b/scenes/globals.gd @@ -5,6 +5,7 @@ signal collected (type) signal acid_aoe (position, scaling) signal lava_aoe (position, scaling) signal ice_aoe (position, scaling) +signal enemy_died (type, scaling) var player_pos: Vector2 @@ -36,3 +37,6 @@ func place_lava_aoe(position: Vector2, scaling: float) -> void: func place_ice_aoe(position: Vector2, scaling: float) -> void: ice_aoe.emit(position, scaling) + +func signal_enemy_died(type: String, position: Vector2, scaling: float) -> void: + enemy_died.emit(type, position, scaling) diff --git a/scenes/levels/level.gd b/scenes/levels/level.gd index c055a43..2da70fe 100644 --- a/scenes/levels/level.gd +++ b/scenes/levels/level.gd @@ -33,6 +33,7 @@ var hero: Hero var _change_scene:bool = false func _ready() -> void: + Globals.enemy_died.connect(_on_enemy_died) Input.set_custom_mouse_cursor(TARGET_ROUND_B, 0, Vector2(30, 30)) for enemy in $Enemies.get_children(): if enemy is Splitting: @@ -237,3 +238,19 @@ func trigger_spawners(): enemy.connect("lava_aoe", _on_lava_ant_lava_aoe) $Enemies.add_child(enemy) num_enemies_spawned += 1 + +func _on_enemy_died(type: String, pos: Vector2, scaling: float) -> void: + print(type) + match type: + "lava ant": + const LAVA_ANT_CORPSE = preload("res://scenes/enemies/lava_ant_corpse.tscn") + var corpse = LAVA_ANT_CORPSE.instantiate() + corpse.scale *= scaling + corpse.position = pos + add_child(corpse) + "acid slug": + const ACID_SLUG_CORPSE = preload("res://scenes/enemies/acid_slug_corpse.tscn") + var corpse = ACID_SLUG_CORPSE.instantiate() + corpse.scale *= scaling + corpse.position = pos + add_child(corpse) diff --git a/shaders/flash_shader_material.tres b/shaders/flash_shader_material.tres index be9c809..d304d08 100644 --- a/shaders/flash_shader_material.tres +++ b/shaders/flash_shader_material.tres @@ -5,5 +5,5 @@ [resource] resource_local_to_scene = true shader = ExtResource("1_1quyw") -shader_parameter/active = false +shader_parameter/active = true shader_parameter/color = Color(1, 1, 1, 1)