Boss can die now

This commit is contained in:
Paul Norberger
2020-04-20 21:46:16 +02:00
parent 294fa5da9d
commit 6e01f59bd6
4 changed files with 175 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=35 format=2]
[gd_scene load_steps=39 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]
@@ -13,6 +13,7 @@
[ext_resource path="res://Boss/SlimeBoss/Animations/move_up.png" type="Texture" id=11]
[ext_resource path="res://Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd" type="Script" id=12]
[ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=13]
[ext_resource path="res://Boss/SlimeBoss/States/Die.gd" type="Script" id=14]
[ext_resource path="res://Overlap/StateMachine/SequenceState.gd" type="Script" id=15]
[ext_resource path="res://Boss/SlimeBoss/States/Charge/Prepare.gd" type="Script" id=16]
[ext_resource path="res://Boss/SlimeBoss/States/Charge/Sprint.gd" type="Script" id=17]
@@ -20,18 +21,19 @@
[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]
[ext_resource path="res://Boss/SlimeBoss/States/BossState.gd" type="Script" id=22]
[sub_resource type="CapsuleShape2D" id=15]
[sub_resource type="CapsuleShape2D" id=1]
radius = 30.0
height = 50.0
[sub_resource type="CapsuleShape2D" id=16]
[sub_resource type="CapsuleShape2D" id=2]
radius = 13.0
height = 30.0
[sub_resource type="CapsuleShape2D" id=17]
radius = 15.0
height = 35.0
[sub_resource type="CapsuleShape2D" id=3]
radius = 20.0
height = 30.0
[sub_resource type="CapsuleShape2D" id=4]
radius = 8.0
@@ -417,6 +419,95 @@ tracks/5/keys = {
"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ]
}
[sub_resource type="Animation" id=15]
resource_name = "Die"
length = 0.6
step = 0.025
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 10 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:vframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 10 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite:hframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 24 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 0.55 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, -28 ), Vector2( 0, -1.90735e-06 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite:flip_h")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite:frame")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4 ]
}
tracks/6/type = "value"
tracks/6/path = NodePath("Sprite:scale")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/keys = {
"times": PoolRealArray( 0, 0.55 ),
"transitions": PoolRealArray( 1, 1.93187 ),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1e-05, 1e-05 ) ]
}
[sub_resource type="Animation" id=10]
length = 1.9
step = 0.025
@@ -797,6 +888,34 @@ tracks/5/keys = {
"values": [ Vector2( 0, -28 ) ]
}
[sub_resource type="Animation" id=16]
resource_name = "__INIT__"
length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -28 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
[node name="SlimeBoss" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 2
@@ -814,6 +933,7 @@ position = Vector2( 0, -8 )
emitting = false
[node name="StompEffect" parent="Effects" instance=ExtResource( 21 )]
visible = false
frame = 29
[node name="Stats" parent="." instance=ExtResource( 3 )]
@@ -865,9 +985,15 @@ script = ExtResource( 19 )
[node name="Stomp" type="Node" parent="States"]
script = ExtResource( 20 )
[node name="Die" type="Node" parent="States"]
script = ExtResource( 14 )
[node name="Death" type="Node" parent="States"]
script = ExtResource( 22 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0, -28 )
texture = ExtResource( 5 )
texture = ExtResource( 10 )
vframes = 10
hframes = 24
@@ -876,7 +1002,7 @@ hframes = 24
[node name="CollisionShape2D" parent="StompHitbox" index="0"]
position = Vector2( 0, 10 )
rotation = 1.5708
shape = SubResource( 15 )
shape = SubResource( 1 )
disabled = true
[node name="Hitbox" parent="." instance=ExtResource( 2 )]
@@ -885,16 +1011,15 @@ collision_layer = 4
[node name="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2( 0, -5 )
rotation = 1.5708
shape = SubResource( 16 )
shape = SubResource( 2 )
[node name="Hurtbox" parent="." instance=ExtResource( 1 )]
collision_layer = 4
collision_mask = 0
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2( 0, -5 )
rotation = 1.5708
shape = SubResource( 17 )
shape = SubResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( -1.52588e-05, 0 )
@@ -919,11 +1044,13 @@ anims/ChargeLeft = SubResource( 6 )
anims/ChargeRight = SubResource( 7 )
anims/ChargeUp = SubResource( 8 )
anims/Charging = SubResource( 9 )
anims/Die = SubResource( 15 )
anims/FightStart = SubResource( 10 )
anims/MoveDown = SubResource( 11 )
anims/MoveLeft = SubResource( 12 )
anims/MoveRight = SubResource( 13 )
anims/MoveUp = SubResource( 14 )
anims/__INIT__ = SubResource( 16 )
[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"]

View File

@@ -56,7 +56,7 @@ func _on_Stats_health_changed(new_health):
elif _phase == PHASES.PHASE_TWO and new_health == 1:
_change_phase(PHASES.PHASE_THREE)
elif _phase == PHASES.PHASE_THREE and new_health < 1:
queue_free()
go_to_next_state($States/Die)
func go_to_next_state(state_override=null):
@@ -98,6 +98,10 @@ func _decide_on_next_state():
return $States/FightStart
if state_active == $States/FightStart:
return $States/ChargeSequence
# Death
if state_active == $States/Die:
queue_free()
# return $States/Dead
if _phase == PHASES.PHASE_ONE:
if angry_phases_done < 1:
@@ -170,11 +174,7 @@ func _decide_on_next_state():
if state_active == $States/ChargeSequence:
return $States/Stomp
# # Death
# if state_active == $States/Die:
# queue_free()
# return $States/Dead
#

View File

@@ -0,0 +1,7 @@
extends "res://Boss/SlimeBoss/States/BossState.gd"
func enter():
animation_player.play("Die")
func _on_animation_finished(anim_name):
emit_signal("finished")