forked from team-sg/hero-mark-2
fix most of the script errors and warnings, fixed a couple tiny bugs in the process :)
This commit is contained in:
parent
9435089f21
commit
72733db609
23 changed files with 55 additions and 63 deletions
|
@ -27,7 +27,8 @@ func _process(delta):
|
|||
if scroll_h && current_sector.x != last_sector.x:
|
||||
position.x = current_sector.x * Game.RESOLUTION.x
|
||||
if respawn_h:
|
||||
var offset = Vector2(8.0 * sign(current_sector.x - last_sector.x), 0.0)
|
||||
# TODO: decide whether to use offset with horizontal respawn
|
||||
# var offset = Vector2(8.0 * sign(current_sector.x - last_sector.x), 0.0)
|
||||
Game.respawn_point = player.global_position
|
||||
last_sector.x = current_sector.x
|
||||
if scroll_v && current_sector.y != last_sector.y:
|
||||
|
|
|
@ -22,8 +22,8 @@ func _ready():
|
|||
#Change color
|
||||
_set_color(color)
|
||||
|
||||
func _set_color(value):
|
||||
color = value
|
||||
func _set_color(new_color):
|
||||
color = new_color
|
||||
if is_inside_tree():
|
||||
sprite.material.set_shader_param("palette", COLORS[color])
|
||||
$Sparkles.color = particle_colors[color]
|
||||
|
|
|
@ -88,15 +88,9 @@ autostart = true
|
|||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 14, 29 )
|
||||
|
||||
[node name="ArrowSpawnTimer" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 26, 27 )
|
||||
frames = SubResource( 5 )
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="BloodPosition" type="Position2D" parent="."]
|
||||
|
@ -114,4 +108,3 @@ volume_db = -8.0
|
|||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||
[connection signal="timeout" from="ShootTimer" to="." method="_on_ShootTimer_timeout"]
|
||||
[connection signal="timeout" from="ArrowSpawnTimer" to="." method="_on_ArrowSpawnTimer_timeout"]
|
||||
|
|
|
@ -111,6 +111,7 @@ func hurt(amount: float, can_duck: bool = false) -> void:
|
|||
emit_signal("health_changed", hp)
|
||||
if state != State.DEAD and hp <= 0.0:
|
||||
state = State.DEAD
|
||||
emit_signal("died")
|
||||
anims.play("die")
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@ const BloodSpray := preload("res://objects/environment/blood/blood_spray.tscn")
|
|||
|
||||
export var spray_ammount: int = 16
|
||||
export var spray_velocity: float = 80
|
||||
export var autoplay: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if autoplay:
|
||||
emitting = true
|
||||
yield(get_tree(), "idle_frame")
|
||||
for i in spray_ammount:
|
||||
var spray = BloodSpray.instance()
|
||||
spray.global_position = global_position
|
||||
|
|
|
@ -43,7 +43,7 @@ func die():
|
|||
bone.global_position = global_position
|
||||
bone.linear_velocity = Vector2(bones_speed * rand_range(0.5, 1.5), 0.0).rotated(rand_range(-PI, 0.0))
|
||||
bone.angular_velocity = rand_range(-PI*2.0, PI*2.0)
|
||||
var timer = get_tree().create_timer(3.0 + rand_range(0.0, 1.0), false)
|
||||
timer.connect("timeout", bone, "queue_free")
|
||||
var bone_timer = get_tree().create_timer(3.0 + rand_range(0.0, 1.0), false)
|
||||
bone_timer.connect("timeout", bone, "queue_free")
|
||||
get_parent().call_deferred("add_child", bone)
|
||||
.die() # call rest of enemy.gd die() funciton
|
||||
|
|
|
@ -101,7 +101,7 @@ func die() -> void:
|
|||
# reset animation
|
||||
sprite.frame_coords.y = 3
|
||||
Audio.play_sound(death_sound, Audio.ac_die)
|
||||
$"%DeathSplatter".emitting = true
|
||||
$"%DeathSplatter".replace_by_instance()
|
||||
|
||||
func _draw() -> void:
|
||||
if Engine.editor_hint:
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://graphics/enemy/turtle.png" type="Texture" id=1]
|
||||
[ext_resource path="res://objects/enemy/turtle.gd" type="Script" id=2]
|
||||
[ext_resource path="res://objects/enemy/death_particles.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=4]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=6]
|
||||
|
@ -82,8 +81,9 @@ position = Vector2( 8.5, 4 )
|
|||
position = Vector2( 11, -0.5 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="DeathSplatter" parent="HeadHitbox/HeadShape" instance=ExtResource( 3 )]
|
||||
[node name="DeathSplatter" parent="HeadHitbox/HeadShape" instance_placeholder="res://objects/enemy/death_particles.tscn"]
|
||||
unique_name_in_owner = true
|
||||
autoplay = true
|
||||
|
||||
[node name="SpikeHitbox" type="Area2D" parent="."]
|
||||
|
||||
|
@ -94,6 +94,8 @@ shape = SubResource( 5 )
|
|||
disabled = true
|
||||
|
||||
[node name="Platform" type="KinematicBody2D" parent="SpikeHitbox"]
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="SpikeHitbox/Platform"]
|
||||
position = Vector2( 8.5, 3 )
|
||||
|
|
|
@ -6,17 +6,11 @@
|
|||
[ext_resource path="res://ui/Boba Date.otf" type="DynamicFontData" id=4]
|
||||
[ext_resource path="res://ui/HooskaiChamferedSquare.ttf" type="DynamicFontData" id=5]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=11]
|
||||
albedo_color = Color( 0.309804, 0.690196, 0.380392, 1 )
|
||||
metallic = 0.35
|
||||
metallic_specular = 0.11
|
||||
|
||||
[sub_resource type="DynamicFont" id=19]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="TextMesh" id=2]
|
||||
resource_local_to_scene = true
|
||||
material = SubResource( 11 )
|
||||
text = "TEXT"
|
||||
font = SubResource( 19 )
|
||||
pixel_size = 0.05
|
||||
|
@ -185,6 +179,11 @@ tracks/4/keys = {
|
|||
"values": [ ExtResource( 4 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=11]
|
||||
albedo_color = Color( 0.309804, 0.690196, 0.380392, 1 )
|
||||
metallic = 0.35
|
||||
metallic_specular = 0.11
|
||||
|
||||
[sub_resource type="Animation" id=20]
|
||||
resource_name = "final score"
|
||||
tracks/0/type = "value"
|
||||
|
@ -658,7 +657,6 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
text = "TEXT"
|
||||
text_material = SubResource( 11 )
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="."]
|
||||
size = Vector2( 256, 192 )
|
||||
|
|
|
@ -58,7 +58,7 @@ func _on_Hitbox_area_entered(area):
|
|||
target.die()
|
||||
#decrease arrows if enemy killed
|
||||
if target_group == "enemy_hitbox":
|
||||
Game.arrows = max(0, Game.arrows - 1) # clamp arrows above 0
|
||||
Game.arrows = max(0, Game.arrows - 1) as int # clamp arrows above 0
|
||||
_persist_trail()
|
||||
queue_free()
|
||||
elif area.is_in_group("arrow"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue