Added stomp effect

This commit is contained in:
Paul Norberger
2020-04-20 19:23:51 +02:00
parent 400f18c37b
commit 0eea6edee7
7 changed files with 214 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=36 format=2]
[gd_scene load_steps=37 format=2]
[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1]
[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2]
@@ -20,6 +20,7 @@
[ext_resource path="res://Effects/Charge/ChargeEffect.tscn" type="PackedScene" id=18]
[ext_resource path="res://Boss/SlimeBoss/States/ReturnToCenter.gd" type="Script" id=19]
[ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20]
[ext_resource path="res://Effects/Stomp/StompEffect.tscn" type="PackedScene" id=21]
[sub_resource type="CircleShape2D" id=1]
radius = 60.0
@@ -813,6 +814,9 @@ __meta__ = {
position = Vector2( 0, -8 )
emitting = false
[node name="StompEffect" parent="Effects" instance=ExtResource( 21 )]
visible = false
[node name="Stats" parent="." instance=ExtResource( 3 )]
max_health = 3
@@ -925,6 +929,7 @@ anims/MoveDown = SubResource( 12 )
anims/MoveLeft = SubResource( 13 )
anims/MoveRight = SubResource( 14 )
anims/MoveUp = SubResource( 15 )
[connection signal="animation_finished" from="Effects/StompEffect" to="States/Stomp" method="_on_StompEffect_animation_finished"]
[connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"]
[connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]

View File

@@ -144,6 +144,30 @@ func _decide_on_next_state():
if state_active == $States/ChargeSequence:
return $States/Stomp
if _phase == PHASES.PHASE_THREE:
if angry_phases_done < 2:
set_invincible(true)
if sequence_cycles < 6:
if state_active == $States/ChargeSequence:
return $States/Stomp
if state_active == $States/Stomp:
sequence_cycles += 1
return $States/ChargeSequence
else:
angry_phases_done = 2
sequence_cycles = 0
return $States/ReturnToCenter
else:
if state_active == $States/ReturnToCenter:
return $States/Stomp # TODO: Maybe Stomp.
if state_active == $States/Stomp:
set_invincible(false)
return $States/RoamSequence
if state_active == $States/RoamSequence:
return $States/ChargeSequence
if state_active == $States/ChargeSequence:
return $States/Stomp
# # Death
# if state_active == $States/Die:
# queue_free()

View File

@@ -1,9 +1,11 @@
extends "res://Boss/SlimeBoss/States/BossState.gd"
onready var stomp_hitbox = owner.get_node("StompHitbox/CollisionShape2D")
onready var stomp_effect = owner.get_node("Effects/StompEffect")
func enter():
stomp_hitbox.disabled = false
stomp_effect.stomp()
func exit():
stomp_hitbox.disabled = true
@@ -11,8 +13,5 @@ func exit():
func update(delta):
play_directional_animation("Charge", owner.last_look)
func _on_animation_finished(anim_name):
anim_name = get_base_anim_name(anim_name)
assert(anim_name == "Charge")
func _on_StompEffect_animation_finished():
emit_signal("finished")