fleshy mines mk 2
This commit is contained in:
parent
4ad5c1877e
commit
6e4d0e77a2
3 changed files with 67 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=22 format=2]
|
[gd_scene load_steps=23 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://objects/Camera2D.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://maps/future/mountain_future.gd" type="Script" id=2]
|
[ext_resource path="res://maps/future/mountain_future.gd" type="Script" id=2]
|
||||||
|
@ -25,6 +25,11 @@ _data = {
|
||||||
"points": PoolVector2Array( -8.18949, 14.1741, 8.18949, -14.1741, 16, -64, -9.43874, -3.7755, 9.43874, 3.7755, 40, -64, -2.83162, -6.60712, 2.83162, 6.60712, 48, -48, -4.4834, -13.9221, 4.4834, 13.9221, 72, -32, 1.88775, -10.8546, -1.88775, 10.8546, 56, -8, -1.65178, -6.84309, 1.65178, 6.84309, 64, 8, 1.17984, -7.07906, -1.17984, 7.07906, 56, 24, 6.84309, -5.66325, -6.84309, 5.66325, 64, 40, 10.1466, -1.88775, -10.1466, 1.88775, 32, 40, -25.3906, 7.57264, 25.3906, -7.57264, 24, 48, 6.90446, 2.44997, -6.90446, -2.44997, 0, 48, 7.12719, -4.23177, -7.12719, 4.23177, -24, 48, 5.34539, 9.57716, -5.34539, -9.57716, -32, 39, 7.12719, 18.2634, -7.12719, -18.2634, -56, 32, -25.5844, -4.02871, 25.5844, 4.02871, -64, 0, 6.61459, 33.0729, -6.61459, -33.0729, -89, -7, -5.35466, 7.24455, 5.35466, -7.24455, -64, -24, -14.4891, 8.81945, 14.4891, -8.81945, -80, -56, -13.5442, -1.25992, 13.5442, 1.25992, -40, -40, -14.1741, -0.629961, 14.1741, 0.629961, -16, -64, -14.4891, -3.46478, 14.4891, 3.46478, 0, -48, -2.83482, 5.98462, 2.83482, -5.98462, 16, -64 )
|
"points": PoolVector2Array( -8.18949, 14.1741, 8.18949, -14.1741, 16, -64, -9.43874, -3.7755, 9.43874, 3.7755, 40, -64, -2.83162, -6.60712, 2.83162, 6.60712, 48, -48, -4.4834, -13.9221, 4.4834, 13.9221, 72, -32, 1.88775, -10.8546, -1.88775, 10.8546, 56, -8, -1.65178, -6.84309, 1.65178, 6.84309, 64, 8, 1.17984, -7.07906, -1.17984, 7.07906, 56, 24, 6.84309, -5.66325, -6.84309, 5.66325, 64, 40, 10.1466, -1.88775, -10.1466, 1.88775, 32, 40, -25.3906, 7.57264, 25.3906, -7.57264, 24, 48, 6.90446, 2.44997, -6.90446, -2.44997, 0, 48, 7.12719, -4.23177, -7.12719, 4.23177, -24, 48, 5.34539, 9.57716, -5.34539, -9.57716, -32, 39, 7.12719, 18.2634, -7.12719, -18.2634, -56, 32, -25.5844, -4.02871, 25.5844, 4.02871, -64, 0, 6.61459, 33.0729, -6.61459, -33.0729, -89, -7, -5.35466, 7.24455, 5.35466, -7.24455, -64, -24, -14.4891, 8.81945, 14.4891, -8.81945, -80, -56, -13.5442, -1.25992, 13.5442, 1.25992, -40, -40, -14.1741, -0.629961, 14.1741, 0.629961, -16, -64, -14.4891, -3.46478, 14.4891, 3.46478, 0, -48, -2.83482, 5.98462, 2.83482, -5.98462, 16, -64 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Curve2D" id=12]
|
||||||
|
_data = {
|
||||||
|
"points": PoolVector2Array( -8.18949, 14.1741, 8.18949, -14.1741, 16, -64, -9.43874, -3.7755, 9.43874, 3.7755, 40, -64, -2.83162, -6.60712, 2.83162, 6.60712, 48, -48, -4.4834, -13.9221, 4.4834, 13.9221, 72, -32, 1.88775, -10.8546, -1.88775, 10.8546, 56, -8, -1.65178, -6.84309, 1.65178, 6.84309, 64, 8, 1.17984, -7.07906, -1.17984, 7.07906, 56, 24, 6.84309, -5.66325, -6.84309, 5.66325, 64, 40, 10.1466, -1.88775, -10.1466, 1.88775, 32, 40, -25.3906, 7.57264, 25.3906, -7.57264, 24, 48, 6.90446, 2.44997, -6.90446, -2.44997, 0, 48, 7.12719, -4.23177, -7.12719, 4.23177, -24, 48, 5.34539, 9.57716, -5.34539, -9.57716, -32, 39, 7.12719, 18.2634, -7.12719, -18.2634, -56, 32, -25.5844, -4.02871, 25.5844, 4.02871, -64, 0, 6.61459, 33.0729, -6.61459, -33.0729, -89, -7, -5.35466, 7.24455, 5.35466, -7.24455, -64, -24, -14.4891, 8.81945, 14.4891, -8.81945, -80, -56, -13.5442, -1.25992, 13.5442, 1.25992, -40, -40, -14.1741, -0.629961, 14.1741, 0.629961, -16, -64, -14.4891, -3.46478, 14.4891, 3.46478, 0, -48, -2.83482, 5.98462, 2.83482, -5.98462, 16, -64 )
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=10]
|
[sub_resource type="Animation" id=10]
|
||||||
resource_name = "liftoff"
|
resource_name = "liftoff"
|
||||||
length = 3.0
|
length = 3.0
|
||||||
|
@ -201,6 +206,14 @@ curve = SubResource( 11 )
|
||||||
segments = 10
|
segments = 10
|
||||||
speed = 128.0
|
speed = 128.0
|
||||||
|
|
||||||
|
[node name="Eel2" parent="Enemies" instance=ExtResource( 9 )]
|
||||||
|
position = Vector2( 400, 112 )
|
||||||
|
rotation = 3.14159
|
||||||
|
scale = Vector2( 1, -1 )
|
||||||
|
curve = SubResource( 12 )
|
||||||
|
segments = 10
|
||||||
|
speed = 128.0
|
||||||
|
|
||||||
[node name="TopMiddle" type="Node2D" parent="Enemies"]
|
[node name="TopMiddle" type="Node2D" parent="Enemies"]
|
||||||
position = Vector2( 128, -96 )
|
position = Vector2( 128, -96 )
|
||||||
|
|
||||||
|
@ -222,7 +235,7 @@ position = Vector2( -128, -88 )
|
||||||
number = 1
|
number = 1
|
||||||
|
|
||||||
[node name="Shard3" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
[node name="Shard3" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
||||||
position = Vector2( 112, -136 )
|
position = Vector2( 128, -128 )
|
||||||
number = 2
|
number = 2
|
||||||
|
|
||||||
[node name="Shard4" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
[node name="Shard4" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
||||||
|
@ -231,6 +244,7 @@ number = 3
|
||||||
|
|
||||||
[node name="Shard5" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
[node name="Shard5" parent="Collectibles/Shards" instance=ExtResource( 21 )]
|
||||||
position = Vector2( 152, 32 )
|
position = Vector2( 152, 32 )
|
||||||
|
number = 4
|
||||||
|
|
||||||
[node name="Stars" type="Node2D" parent="Collectibles"]
|
[node name="Stars" type="Node2D" parent="Collectibles"]
|
||||||
|
|
||||||
|
@ -255,6 +269,9 @@ color = 4
|
||||||
|
|
||||||
[node name="DebugStar" type="Node2D" parent="Collectibles/Stars"]
|
[node name="DebugStar" type="Node2D" parent="Collectibles/Stars"]
|
||||||
position = Vector2( 160, -32 )
|
position = Vector2( 160, -32 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_group_": true
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Star" parent="Collectibles/Stars/DebugStar" instance=ExtResource( 14 )]
|
[node name="Star" parent="Collectibles/Stars/DebugStar" instance=ExtResource( 14 )]
|
||||||
|
|
||||||
|
@ -290,3 +307,6 @@ anims/liftoff = SubResource( 10 )
|
||||||
|
|
||||||
[connection signal="timeout" from="LightningTimer" to="." method="_spawn_lightning"]
|
[connection signal="timeout" from="LightningTimer" to="." method="_spawn_lightning"]
|
||||||
[connection signal="tree_entered" from="Background/BackgroundMountain/Mountain" to="Background/BackgroundMountain/Mountain" method="set_visible" binds= [ true ]]
|
[connection signal="tree_entered" from="Background/BackgroundMountain/Mountain" to="Background/BackgroundMountain/Mountain" method="set_visible" binds= [ true ]]
|
||||||
|
[connection signal="collected" from="Collectibles/Shards/Shard3" to="Enemies/TopMiddle/Mine" method="kill_for_real"]
|
||||||
|
[connection signal="collected" from="Collectibles/Shards/Shard3" to="Enemies/TopMiddle/Mine2" method="kill_for_real"]
|
||||||
|
[connection signal="collected" from="Collectibles/Shards/Shard3" to="Enemies/TopMiddle/Mine3" method="kill_for_real"]
|
||||||
|
|
|
@ -2,12 +2,17 @@ extends "res://objects/enemy/enemy.gd"
|
||||||
|
|
||||||
const Explosion = preload("res://objects/enemy/explosion.tscn")
|
const Explosion = preload("res://objects/enemy/explosion.tscn")
|
||||||
|
|
||||||
|
export var linked_shard: int
|
||||||
|
|
||||||
onready var chain = $Chain
|
onready var chain = $Chain
|
||||||
onready var hitbox = $Hitbox
|
onready var hitbox = $Hitbox
|
||||||
onready var respawn_time: float = 1.0
|
onready var respawn_time: float = 1.0
|
||||||
|
onready var ground_cast = $GroundCast
|
||||||
|
|
||||||
|
var no_explosion := false
|
||||||
|
var die_flag := false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var ground_cast = $GroundCast
|
|
||||||
ground_cast.force_raycast_update()
|
ground_cast.force_raycast_update()
|
||||||
if ground_cast.is_colliding():
|
if ground_cast.is_colliding():
|
||||||
chain.points[1].y = chain.to_local(ground_cast.get_collision_point()).y
|
chain.points[1].y = chain.to_local(ground_cast.get_collision_point()).y
|
||||||
|
@ -15,7 +20,14 @@ func _ready():
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
chain.points[0].x = hitbox.position.x
|
chain.points[0].x = hitbox.position.x
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if Game.shards_collected[linked_shard] and not die_flag:
|
||||||
|
die_flag = true
|
||||||
|
kill_for_real()
|
||||||
|
|
||||||
func _on_Hitbox_area_entered(area):
|
func _on_Hitbox_area_entered(area):
|
||||||
|
if no_explosion:
|
||||||
|
return
|
||||||
if area.is_in_group("explosion"):
|
if area.is_in_group("explosion"):
|
||||||
var timer = get_tree().create_timer(0.2, false)
|
var timer = get_tree().create_timer(0.2, false)
|
||||||
timer.connect("timeout", self, "die")
|
timer.connect("timeout", self, "die")
|
||||||
|
@ -26,16 +38,43 @@ func _on_Hitbox_area_entered(area):
|
||||||
die()
|
die()
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
|
no_explosion = true
|
||||||
|
if Game.shards_collected[linked_shard]:
|
||||||
|
kill_for_real()
|
||||||
|
return
|
||||||
if blood:
|
if blood:
|
||||||
var death_particles = DeathParticles.instance()
|
var death_particles = DeathParticles.instance()
|
||||||
death_particles.global_position = hitbox.global_position
|
death_particles.global_position = hitbox.global_position
|
||||||
death_particles.emitting = true
|
death_particles.emitting = true
|
||||||
get_parent().get_parent().add_child(death_particles)
|
get_parent().get_parent().add_child(death_particles)
|
||||||
$Hitbox/Sprite.visible = false
|
$Hitbox/Sprite.visible = false
|
||||||
hitbox.monitoring = false
|
$Hitbox/CollisionShape2D.disabled = true
|
||||||
hitbox.monitorable = false
|
hitbox.monitorable = false
|
||||||
yield(get_tree().create_timer(respawn_time), "timeout")
|
hitbox.monitoring = false
|
||||||
|
Audio.play_sound(death_sound, Audio.ac_die)
|
||||||
|
yield(get_tree().create_timer(respawn_time, false), "timeout")
|
||||||
|
$Hitbox/CollisionShape2D.disabled = false
|
||||||
|
$Hitbox/Sprite.visible = true
|
||||||
hitbox.monitorable = true
|
hitbox.monitorable = true
|
||||||
hitbox.monitoring = true
|
hitbox.monitoring = true
|
||||||
$Hitbox/Sprite.visible = true
|
no_explosion = false
|
||||||
|
|
||||||
|
func kill_for_real():
|
||||||
|
hitbox.visible = false
|
||||||
|
hitbox.monitorable = false
|
||||||
|
hitbox.monitoring = false
|
||||||
|
$Hitbox/CollisionShape2D.disabled = true
|
||||||
|
if blood:
|
||||||
|
var dist := 0.0
|
||||||
|
while(true):
|
||||||
|
var death_particles = DeathParticles.instance()
|
||||||
|
death_particles.global_position = hitbox.global_position + Vector2(0.0, dist)
|
||||||
|
death_particles.emitting = true
|
||||||
|
get_parent().get_parent().add_child(death_particles)
|
||||||
|
if dist < hitbox.to_local(ground_cast.get_collision_point()).y:
|
||||||
|
dist += 8.0
|
||||||
|
yield(get_tree().create_timer(0.05, false), "timeout")
|
||||||
|
Audio.play_sound(death_sound, Audio.ac_die)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
queue_free()
|
||||||
|
|
|
@ -71,6 +71,7 @@ tracks/1/keys = {
|
||||||
|
|
||||||
[node name="Mine" type="Node2D"]
|
[node name="Mine" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
linked_shard = 2
|
||||||
|
|
||||||
[node name="GroundCast" type="RayCast2D" parent="."]
|
[node name="GroundCast" type="RayCast2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue