waited far too long for an initial commit but here we are
This commit is contained in:
85
Worlds/GreenPlanet/Enemies/air_enemy.tscn
Normal file
85
Worlds/GreenPlanet/Enemies/air_enemy.tscn
Normal file
@ -0,0 +1,85 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bjo2q6vca5qlv"]
|
||||
|
||||
[ext_resource type="Script" path="res://Worlds/GreenPlanet/Enemies/air_enemy_controller.gd" id="1_lyo1o"]
|
||||
[ext_resource type="Resource" uid="uid://dsgkwh3opyqtx" path="res://Worlds/GreenPlanet/Enemies/airenemy.tres" id="2_6qx4a"]
|
||||
[ext_resource type="Script" path="res://Scripts/health.gd" id="3_wiose"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqtew0t8sttpm" path="res://Scenes/damage_particle.tscn" id="4_mhq3m"]
|
||||
[ext_resource type="Script" path="res://Scripts/hitbox.gd" id="5_433ie"]
|
||||
[ext_resource type="Texture2D" uid="uid://chhmkmlfrobhu" path="res://Assets/Textures/bubble.png" id="6_ke2c8"]
|
||||
[ext_resource type="Texture2D" uid="uid://r202vo47jw1q" path="res://Assets/Textures/enemyhealth.png" id="8_77uyi"]
|
||||
[ext_resource type="Script" path="res://Scripts/StatusEffector.gd" id="9_7hati"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1fn60m6xfcsq" path="res://Assets/Textures/minimap_enemy.png" id="9_7yfyh"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_21dgw"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_ss5ir"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[node name="Dog" type="CharacterBody3D" node_paths=PackedStringArray("status_manager") groups=["Enemies"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 3
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_lyo1o")
|
||||
stats = ExtResource("2_6qx4a")
|
||||
status_manager = NodePath("StatusEffector")
|
||||
|
||||
[node name="Health" type="Node" parent="."]
|
||||
script = ExtResource("3_wiose")
|
||||
damage_particle_scene = ExtResource("4_mhq3m")
|
||||
|
||||
[node name="Hitbox" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.527022, 0)
|
||||
shape = SubResource("SphereShape3D_21dgw")
|
||||
script = ExtResource("5_433ie")
|
||||
|
||||
[node name="Sprite3D3" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.56, 0, 0, 0, 1.56, 0, 0, 0, 1.56, 0, 0.546419, 0)
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("6_ke2c8")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 1.15918, 0)
|
||||
pixel_size = 0.02
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_ss5ir")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(2, 0, 0, 0, -8.74228e-08, 2, 0, -2, -8.74228e-08, 0, 1.40824, 0)
|
||||
layers = 4
|
||||
texture_filter = 0
|
||||
texture = ExtResource("9_7yfyh")
|
||||
|
||||
[node name="StatusEffector" type="Node3D" parent="." node_paths=PackedStringArray("hbox")]
|
||||
script = ExtResource("9_7hati")
|
||||
hbox = NodePath("../SubViewport/HBoxContainer")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(200, 55)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="SubViewport"]
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_bottom = 32.0
|
||||
grow_horizontal = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="ProgressBar" type="TextureProgressBar" parent="SubViewport"]
|
||||
visible = false
|
||||
offset_top = 36.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 236.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
step = 0.0
|
||||
value = 100.0
|
||||
fill_mode = 6
|
||||
texture_progress = ExtResource("8_77uyi")
|
||||
tint_progress = Color(0, 1, 0, 1)
|
||||
|
||||
[connection signal="health_changed" from="Health" to="." method="_on_health_health_changed"]
|
||||
[connection signal="health_depleted" from="Health" to="." method="_on_health_health_depleted"]
|
||||
[connection signal="took_damage" from="Hitbox" to="Health" method="take_damage"]
|
54
Worlds/GreenPlanet/Enemies/air_enemy_controller.gd
Normal file
54
Worlds/GreenPlanet/Enemies/air_enemy_controller.gd
Normal file
@ -0,0 +1,54 @@
|
||||
extends CharacterBody3D
|
||||
class_name AirEnemyController
|
||||
|
||||
signal reached_goal(penalty)
|
||||
signal died
|
||||
|
||||
var alive = true
|
||||
|
||||
@export var stats : Enemy
|
||||
@export var status_manager : StatusEffector
|
||||
|
||||
var movement_speed
|
||||
var progress := 0.0
|
||||
var progress_ratio := 0.0
|
||||
var destination : Node3D
|
||||
|
||||
func _ready() -> void:
|
||||
$Health.max_health = stats.health
|
||||
$Health.current_health = stats.health
|
||||
$SubViewport/ProgressBar.max_value = stats.health
|
||||
$SubViewport/ProgressBar.value = stats.health
|
||||
$Sprite3D3.texture = stats.sprite.duplicate()
|
||||
movement_speed = stats.movement_speed
|
||||
|
||||
|
||||
func damage(amount):
|
||||
$Hitbox.damage(amount)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
progress += movement_speed * delta
|
||||
velocity = global_position.direction_to(destination.global_position) * movement_speed
|
||||
move_and_slide()
|
||||
if global_position.distance_to(destination.global_position) <= 1.0:
|
||||
reached_goal.emit(stats.penalty)
|
||||
queue_free()
|
||||
|
||||
|
||||
func die():
|
||||
died.emit()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_health_health_depleted() -> void:
|
||||
if alive:
|
||||
alive = false
|
||||
die()
|
||||
|
||||
|
||||
func _on_health_health_changed(health) -> void:
|
||||
$SubViewport/ProgressBar.value = health
|
||||
var percent = float($Health.current_health) / float($Health.max_health)
|
||||
$SubViewport/ProgressBar.tint_progress = Color(1 - percent, percent, 0.0)
|
||||
$SubViewport/ProgressBar.set_visible(true)
|
17
Worlds/GreenPlanet/Enemies/airenemy.tres
Normal file
17
Worlds/GreenPlanet/Enemies/airenemy.tres
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=4 format=3 uid="uid://dsgkwh3opyqtx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://chhmkmlfrobhu" path="res://Assets/Textures/bubble.png" id="1_57rr1"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_wjbfx"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0vafwv4lhjji" path="res://Assets/TextureAtlases/bubble.tres" id="3_homny"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_wjbfx")
|
||||
title = "bubble"
|
||||
target_type = 2
|
||||
icon = ExtResource("1_57rr1")
|
||||
sprite = ExtResource("3_homny")
|
||||
spawn_power = 4
|
||||
health = 40
|
||||
penalty = 4
|
||||
movement_speed = 1.5
|
||||
spawn_cooldown = 1.0
|
17
Worlds/GreenPlanet/Enemies/airenemy2.tres
Normal file
17
Worlds/GreenPlanet/Enemies/airenemy2.tres
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=4 format=3 uid="uid://bffhb5krs5elm"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://duywsy7jmh4u" path="res://Assets/Textures/spike.png" id="1_22o7e"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_q5r05"]
|
||||
[ext_resource type="Texture2D" uid="uid://sybn6bjbj5fh" path="res://Assets/TextureAtlases/spike.tres" id="3_tbb38"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_q5r05")
|
||||
title = "spike"
|
||||
target_type = 2
|
||||
icon = ExtResource("1_22o7e")
|
||||
sprite = ExtResource("3_tbb38")
|
||||
spawn_power = 8
|
||||
health = 100
|
||||
penalty = 7
|
||||
movement_speed = 1.0
|
||||
spawn_cooldown = 1.0
|
23
Worlds/GreenPlanet/Enemies/dog.tres
Normal file
23
Worlds/GreenPlanet/Enemies/dog.tres
Normal file
@ -0,0 +1,23 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=5 format=3 uid="uid://8eba45hql7bo"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_2lqbg"]
|
||||
[ext_resource type="Texture2D" uid="uid://g00wwrlxxdc5" path="res://Assets/Textures/icon_eye_dog.png" id="1_es0ht"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj13g1w14mekw" path="res://Assets/Textures/eye_dog.png" id="2_vgx18"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n6kdu"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("2_vgx18")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
script = ExtResource("1_2lqbg")
|
||||
title = "dog"
|
||||
target_type = 1
|
||||
icon = ExtResource("1_es0ht")
|
||||
sprite = SubResource("AtlasTexture_n6kdu")
|
||||
spawn_power = 10
|
||||
health = 200
|
||||
penalty = 10
|
||||
movement_speed = 1.2
|
||||
spawn_cooldown = 1.2
|
17
Worlds/GreenPlanet/Enemies/dog_boss.tres
Normal file
17
Worlds/GreenPlanet/Enemies/dog_boss.tres
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=4 format=3 uid="uid://boik1gnpl4v0a"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cde0voyrwnqkl" path="res://Assets/Textures/icon_eye_dog_boss.png" id="1_2o720"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_euaab"]
|
||||
[ext_resource type="Texture2D" uid="uid://ff3cys53p37j" path="res://Assets/TextureAtlases/dog_fast_boss.tres" id="2_1m62w"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_euaab")
|
||||
title = "boss dog"
|
||||
target_type = 1
|
||||
icon = ExtResource("1_2o720")
|
||||
sprite = ExtResource("2_1m62w")
|
||||
spawn_power = 100
|
||||
health = 1000
|
||||
penalty = 40
|
||||
movement_speed = 1.0
|
||||
spawn_cooldown = 1.0
|
17
Worlds/GreenPlanet/Enemies/dog_fast.tres
Normal file
17
Worlds/GreenPlanet/Enemies/dog_fast.tres
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=4 format=3 uid="uid://cvehqh4tt28g7"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_k5sd1"]
|
||||
[ext_resource type="Texture2D" uid="uid://cv5p03aw78vwd" path="res://Assets/Textures/icon_eye_dog_fast.png" id="1_xgen5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd212gh03wloa" path="res://Assets/TextureAtlases/dog_fast.tres" id="2_mkbm6"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_k5sd1")
|
||||
title = "fast dog"
|
||||
target_type = 1
|
||||
icon = ExtResource("1_xgen5")
|
||||
sprite = ExtResource("2_mkbm6")
|
||||
spawn_power = 16
|
||||
health = 100
|
||||
penalty = 4
|
||||
movement_speed = 3.5
|
||||
spawn_cooldown = 0.7
|
17
Worlds/GreenPlanet/Enemies/dog_heavy.tres
Normal file
17
Worlds/GreenPlanet/Enemies/dog_heavy.tres
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="Enemy" load_steps=4 format=3 uid="uid://dxi17xvdlhkvc"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://08n5jvq5tptf" path="res://Assets/Textures/icon_eye_dog_heavy.png" id="1_lck53"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/enemy.gd" id="1_q48il"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0543ucoalwmi" path="res://Assets/TextureAtlases/dog_fast_heavy.tres" id="2_7nc4x"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_q48il")
|
||||
title = "heavy dog"
|
||||
target_type = 1
|
||||
icon = ExtResource("1_lck53")
|
||||
sprite = ExtResource("2_7nc4x")
|
||||
spawn_power = 14
|
||||
health = 400
|
||||
penalty = 10
|
||||
movement_speed = 0.8
|
||||
spawn_cooldown = 2.0
|
48
Worlds/GreenPlanet/Enemies/enemy_controller.gd
Normal file
48
Worlds/GreenPlanet/Enemies/enemy_controller.gd
Normal file
@ -0,0 +1,48 @@
|
||||
extends PathFollow3D
|
||||
class_name EnemyController
|
||||
|
||||
signal reached_goal(penalty)
|
||||
signal died
|
||||
|
||||
var alive = true
|
||||
|
||||
@export var stats : Enemy
|
||||
@export var status_manager : StatusEffector
|
||||
var movement_speed
|
||||
|
||||
func _ready() -> void:
|
||||
$Dog/Health.max_health = stats.health
|
||||
$Dog/Health.current_health = stats.health
|
||||
$Dog/SubViewport/ProgressBar.max_value = stats.health
|
||||
$Dog/SubViewport/ProgressBar.value = stats.health
|
||||
$Dog/DirectionSprite.texture = stats.sprite.duplicate()
|
||||
movement_speed = stats.movement_speed
|
||||
|
||||
|
||||
func damage(amount):
|
||||
$Dog/Hitbox.damage(amount)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
progress += movement_speed * delta
|
||||
if progress_ratio >= 1:
|
||||
reached_goal.emit(stats.penalty)
|
||||
queue_free()
|
||||
|
||||
|
||||
func die():
|
||||
died.emit()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_health_health_depleted() -> void:
|
||||
if alive:
|
||||
alive = false
|
||||
die()
|
||||
|
||||
|
||||
func _on_health_health_changed(health) -> void:
|
||||
$Dog/SubViewport/ProgressBar.value = health
|
||||
var percent = float($Dog/Health.current_health) / float($Dog/Health.max_health)
|
||||
$Dog/SubViewport/ProgressBar.tint_progress = Color(1 - percent, percent, 0.0)
|
||||
$Dog/SubViewport/ProgressBar.set_visible(true)
|
93
Worlds/GreenPlanet/Enemies/land_enemy.tscn
Normal file
93
Worlds/GreenPlanet/Enemies/land_enemy.tscn
Normal file
@ -0,0 +1,93 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://b0nady5xm88bo"]
|
||||
|
||||
[ext_resource type="Script" path="res://Worlds/GreenPlanet/Enemies/enemy_controller.gd" id="1_fwsjt"]
|
||||
[ext_resource type="Script" path="res://Scripts/hitbox.gd" id="2_j8yin"]
|
||||
[ext_resource type="PackedScene" uid="uid://ri8r03wqy80t" path="res://Scenes/8_direction_sprite.tscn" id="2_o7jmg"]
|
||||
[ext_resource type="Resource" uid="uid://8eba45hql7bo" path="res://Worlds/GreenPlanet/Enemies/dog.tres" id="2_sswqn"]
|
||||
[ext_resource type="Script" path="res://Scripts/health.gd" id="2_swu53"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj13g1w14mekw" path="res://Assets/Textures/eye_dog.png" id="3_naknq"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqtew0t8sttpm" path="res://Scenes/damage_particle.tscn" id="4_tn1tu"]
|
||||
[ext_resource type="Texture2D" uid="uid://r202vo47jw1q" path="res://Assets/Textures/enemyhealth.png" id="8_5ba7s"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1fn60m6xfcsq" path="res://Assets/Textures/minimap_enemy.png" id="9_f8btv"]
|
||||
[ext_resource type="Script" path="res://Scripts/StatusEffector.gd" id="10_txouh"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_21dgw"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_75ly7"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("3_naknq")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_4tj6k"]
|
||||
viewport_path = NodePath("Dog/SubViewport")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" node_paths=PackedStringArray("status_manager") groups=["Enemies"]]
|
||||
loop = false
|
||||
script = ExtResource("1_fwsjt")
|
||||
stats = ExtResource("2_sswqn")
|
||||
status_manager = NodePath("Dog/StatusEffector")
|
||||
|
||||
[node name="Dog" type="CharacterBody3D" parent="."]
|
||||
collision_layer = 4
|
||||
collision_mask = 3
|
||||
|
||||
[node name="Health" type="Node" parent="Dog"]
|
||||
script = ExtResource("2_swu53")
|
||||
damage_particle_scene = ExtResource("4_tn1tu")
|
||||
|
||||
[node name="Hitbox" type="CollisionShape3D" parent="Dog"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.527022, 0)
|
||||
shape = SubResource("SphereShape3D_21dgw")
|
||||
script = ExtResource("2_j8yin")
|
||||
|
||||
[node name="DirectionSprite" parent="Dog" instance=ExtResource("2_o7jmg")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.642479, 0)
|
||||
pixel_size = 0.04
|
||||
texture = SubResource("AtlasTexture_75ly7")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Dog"]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 1.20821, 0)
|
||||
pixel_size = 0.02
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = SubResource("ViewportTexture_4tj6k")
|
||||
|
||||
[node name="Sprite3D2" type="Sprite3D" parent="Dog"]
|
||||
transform = Transform3D(2, 0, 0, 0, -8.74228e-08, 2, 0, -2, -8.74228e-08, 0, 1.40824, 0)
|
||||
layers = 4
|
||||
texture_filter = 0
|
||||
texture = ExtResource("9_f8btv")
|
||||
|
||||
[node name="StatusEffector" type="Node3D" parent="Dog" node_paths=PackedStringArray("hbox")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.18114, 0)
|
||||
script = ExtResource("10_txouh")
|
||||
hbox = NodePath("../SubViewport/HBoxContainer")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="Dog"]
|
||||
transparent_bg = true
|
||||
size = Vector2i(200, 55)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Dog/SubViewport"]
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_bottom = 32.0
|
||||
grow_horizontal = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="ProgressBar" type="TextureProgressBar" parent="Dog/SubViewport"]
|
||||
visible = false
|
||||
offset_top = 36.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 236.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
step = 0.0
|
||||
value = 100.0
|
||||
fill_mode = 6
|
||||
texture_progress = ExtResource("8_5ba7s")
|
||||
tint_progress = Color(0, 1, 0, 1)
|
||||
|
||||
[connection signal="health_changed" from="Dog/Health" to="." method="_on_health_health_changed"]
|
||||
[connection signal="health_depleted" from="Dog/Health" to="." method="_on_health_health_depleted"]
|
||||
[connection signal="took_damage" from="Dog/Hitbox" to="Dog/Health" method="take_damage"]
|
Reference in New Issue
Block a user