forked from team-sg/hero-mark-2
skeleton proper death sound, better bone particles
This commit is contained in:
parent
30d7e84a46
commit
b1beffd97b
10 changed files with 46 additions and 10 deletions
|
@ -5,9 +5,8 @@
|
|||
[sub_resource type="PhysicsMaterial" id=2]
|
||||
bounce = 0.75
|
||||
|
||||
[sub_resource type="SegmentShape2D" id=1]
|
||||
a = Vector2( 0, -2 )
|
||||
b = Vector2( 0, 2 )
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 0.5, 1.5 )
|
||||
|
||||
[node name="BoneParticle" type="RigidBody2D"]
|
||||
collision_layer = 16
|
||||
|
@ -17,4 +16,8 @@ physics_material_override = SubResource( 2 )
|
|||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
position = Vector2( -0.5, 0.5 )
|
||||
shape = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ const DeathParticles = preload("res://objects/enemy/death_particles.tscn")
|
|||
#export var can_be_squashed = true
|
||||
|
||||
export var score_for_killing = 0
|
||||
export var blood = true
|
||||
|
||||
var death_sound = Game.a_die
|
||||
|
||||
func _on_Hitbox_area_entered(area):
|
||||
#Kill player
|
||||
|
@ -24,11 +27,12 @@ func _on_Hitbox_area_entered(area):
|
|||
area.get_parent().die()
|
||||
|
||||
func die():
|
||||
var death_particles = DeathParticles.instance()
|
||||
death_particles.global_position = global_position
|
||||
death_particles.emitting = true
|
||||
get_parent().add_child(death_particles)
|
||||
if blood:
|
||||
var death_particles = DeathParticles.instance()
|
||||
death_particles.global_position = global_position
|
||||
death_particles.emitting = true
|
||||
get_parent().add_child(death_particles)
|
||||
|
||||
Game.play_sound(Game.a_die, Game.ac_die)
|
||||
Game.play_sound(death_sound, Game.ac_die)
|
||||
Game.score += score_for_killing
|
||||
queue_free()
|
||||
|
|
|
@ -15,6 +15,7 @@ onready var anims = $AnimationPlayer
|
|||
onready var sprite = $Sprite
|
||||
|
||||
func _ready():
|
||||
death_sound = Game.a_bone
|
||||
timer.start(shoot_time)
|
||||
|
||||
func _on_Timer_timeout():
|
||||
|
|
|
@ -143,6 +143,7 @@ tracks/3/keys = {
|
|||
|
||||
[node name="Skelarcher" type="Node2D" groups=["enemy"]]
|
||||
script = ExtResource( 4 )
|
||||
blood = false
|
||||
shoot_time = 3.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
|
|
@ -55,6 +55,9 @@ func _on_Hitbox_area_entered(area):
|
|||
if target_group == "enemy_hitbox":
|
||||
Game.arrows = max(0, Game.arrows - 1) # clamp arrows above 0
|
||||
queue_free()
|
||||
elif area.is_in_group("arrow"):
|
||||
_make_sparks()
|
||||
queue_free()
|
||||
|
||||
func _make_sparks():
|
||||
var particles = $SparkParticles
|
||||
|
|
|
@ -75,7 +75,6 @@ process_material = SubResource( 5 )
|
|||
texture = ExtResource( 4 )
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["arrow"]]
|
||||
collision_layer = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( -0.5, -0.5 )
|
||||
|
@ -86,6 +85,7 @@ position = Vector2( 4, 0 )
|
|||
emitting = false
|
||||
amount = 16
|
||||
lifetime = 0.5
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource( 8 )
|
||||
texture = ExtResource( 4 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue