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")

View File

@@ -14,6 +14,9 @@
[ext_resource path="res://Maps/Tilesets/Edge/tileset_edge.png" type="Texture" id=12]
[ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
@@ -35,10 +38,7 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
[sub_resource type="TileSet" id=1]
[sub_resource type="TileSet" id=9]
1/name = "tileset_edge.png 1"
1/texture = ExtResource( 12 )
1/tex_offset = Vector2( 0, 0 )
@@ -72,14 +72,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
2/navigation_offset = Vector2( 0, 0 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape = SubResource( 2 )
2/shape = SubResource( 1 )
2/shape_one_way = false
2/shape_one_way_margin = 1.0
2/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
2/z_index = 0
@@ -93,14 +93,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
3/navigation_offset = Vector2( 0, 0 )
3/shape_offset = Vector2( 0, 0 )
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
3/shape = SubResource( 3 )
3/shape = SubResource( 2 )
3/shape_one_way = false
3/shape_one_way_margin = 1.0
3/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
3/z_index = 0
@@ -114,14 +114,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
4/navigation_offset = Vector2( 0, 0 )
4/shape_offset = Vector2( 0, 0 )
4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
4/shape = SubResource( 4 )
4/shape = SubResource( 3 )
4/shape_one_way = false
4/shape_one_way_margin = 1.0
4/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
4/z_index = 0
@@ -135,14 +135,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
5/navigation_offset = Vector2( 0, 0 )
5/shape_offset = Vector2( 0, 0 )
5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
5/shape = SubResource( 5 )
5/shape = SubResource( 4 )
5/shape_one_way = false
5/shape_one_way_margin = 1.0
5/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
5/z_index = 0
@@ -156,14 +156,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
6/navigation_offset = Vector2( 0, 0 )
6/shape_offset = Vector2( 0, 0 )
6/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
6/shape = SubResource( 6 )
6/shape = SubResource( 5 )
6/shape_one_way = false
6/shape_one_way_margin = 1.0
6/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
6/z_index = 0
@@ -177,14 +177,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
7/navigation_offset = Vector2( 0, 0 )
7/shape_offset = Vector2( 0, 0 )
7/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
7/shape = SubResource( 7 )
7/shape = SubResource( 6 )
7/shape_one_way = false
7/shape_one_way_margin = 1.0
7/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
7/z_index = 0
@@ -198,14 +198,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
8/navigation_offset = Vector2( 0, 0 )
8/shape_offset = Vector2( 0, 0 )
8/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
8/shape = SubResource( 8 )
8/shape = SubResource( 7 )
8/shape_one_way = false
8/shape_one_way_margin = 1.0
8/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
8/z_index = 0
@@ -219,14 +219,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
9/navigation_offset = Vector2( 0, 0 )
9/shape_offset = Vector2( 0, 0 )
9/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
9/shape = SubResource( 9 )
9/shape = SubResource( 8 )
9/shape_one_way = false
9/shape_one_way_margin = 1.0
9/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
9/z_index = 0
@@ -241,16 +241,17 @@ region_enabled = true
region_rect = Rect2( 0, 0, 1280, 720 )
[node name="Background" parent="." instance=ExtResource( 7 )]
frame = 0
frame = 32
[node name="FloorTileMap" type="TileMap" parent="."]
visible = false
position = Vector2( 16, 16 )
tile_set = ExtResource( 3 )
cell_size = Vector2( 32, 32 )
collision_layer = 2
collision_mask = 0
format = 1
tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, -1610612689, 196609, -65534, -1610612689, 196609, -65533, -1610612689, 196609, -65532, -1610612689, 196609, -65531, -1610612689, 196609, -65530, -1610612689, 196609, -65529, -1610612689, 196609, -65528, -1610612689, 196609, -65527, -1610612689, 196609, -65526, -1610612689, 196609, -65525, -1610612689, 196609, -65524, -1610612689, 196609, -65523, -1610612689, 196610, -65522, -1610612720, 131073, 65535, -1610612689, 65539, 14, -1610612689, 3, 131071, 47, 65539, 65550, -1610612689, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327680, 16, 65536, 327681, 16, 65537, 327682, 16, 65538, 327683, 16, 131073, 327684, 16, 131073, 327685, 16, 131073, 327686, 16, 131073, 327687, 16, 131073, 327688, 16, 131073, 327689, 16, 131073, 327690, 16, 131073, 327691, 16, 131073, 327692, 16, 131073, 327693, 16, 131073, 327694, -1610612689, 65539, 458751, -1610612689, 65539, 393216, 16, 196608, 393217, 16, 196609, 393218, 16, 196610, 393219, -1610612689, 0, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, -1610612689, 131079, 524287, -1610612689, 196612, 458752, 47, 196609, 458753, 47, 196609, 458754, 47, 196609, 458755, 47, 196614, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, -1610612689, 131074 )
tile_data = PoolIntArray( -1, 47, 4, -65536, 47, 196609, -65535, 47, 196609, -65534, 47, 196609, -65533, 47, 196609, -65532, 47, 196609, -65531, 47, 196609, -65530, 47, 196609, -65529, 47, 196609, -65528, 47, 196609, -65527, 47, 196609, -65526, 47, 196609, -65525, 47, 196609, -65524, 47, 196609, -65523, 47, 196609, -65522, 47, 7, 65535, 47, 65539, 14, 47, 65539, 131071, 47, 65539, 65550, 47, 65539, 196607, 47, 65539, 131086, 47, 65539, 262143, 47, 65539, 196622, 47, 65539, 327679, 47, 65539, 262158, 47, 65539, 393215, 47, 131076, 327680, 47, 1, 327681, 47, 1, 327682, 47, 1, 327683, 47, 1, 327684, 47, 1, 327685, 47, 1, 327686, 47, 1, 327687, 47, 1, 327688, 47, 1, 327689, 47, 1, 327690, 47, 1, 327691, 47, 1, 327692, 47, 1, 327693, 47, 1, 327694, 47, 131079, 458751, 47, 65536, 393216, 47, 65537, 393217, 47, 65537, 393218, 47, 65537, 393219, 47, 65537, 393220, 47, 65537, 393221, 47, 65537, 393222, 47, 65537, 393223, 47, 65537, 393224, 47, 65537, 393225, 47, 65537, 393226, 47, 65537, 393227, 47, 65537, 393228, 47, 65537, 393229, 47, 65537, 393230, 47, 65538, 524287, 47, 131072, 458752, 47, 131073, 458753, 47, 131073, 458754, 47, 131073, 458755, 47, 131073, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, 47, 131074 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
@@ -258,7 +259,7 @@ __meta__ = {
[node name="Edge" type="TileMap" parent="."]
position = Vector2( 16, 16 )
tile_set = SubResource( 1 )
tile_set = SubResource( 9 )
cell_size = Vector2( 32, 32 )
format = 1
tile_data = PoolIntArray( -1, 5, 0, -65536, 3, 0, -65535, 3, 0, -65534, 3, 0, -65533, 3, 0, -65532, 3, 0, -65531, 3, 0, -65530, 3, 0, -65529, 3, 0, -65528, 3, 0, -65527, 3, 0, -65526, 3, 0, -65525, 3, 0, -65524, 3, 0, -65523, 3, 0, -65522, 4, 0, 65535, 2, 0, 14, 6, 0, 131071, 2, 0, 65550, 6, 0, 196607, 2, 0, 131086, 6, 0, 262143, 2, 0, 196622, 6, 0, 327679, 2, 0, 262158, 6, 0, 393215, 9, 0, 327680, 7, 0, 327681, 7, 0, 327682, 7, 0, 327683, 7, 0, 327684, 7, 0, 327685, 7, 0, 327686, 7, 0, 327687, 7, 0, 327688, 7, 0, 327689, 7, 0, 327690, 7, 0, 327691, 7, 0, 327692, 7, 0, 327693, 7, 0, 327694, 8, 0, 458751, 0, 0 )