forked from team-sg/hero-mark-2
stalactite wiggle
This commit is contained in:
parent
8f14ca22cb
commit
21c68de88f
3 changed files with 32 additions and 8 deletions
|
@ -76,7 +76,7 @@ tile_set = ExtResource( 22 )
|
||||||
cell_size = Vector2( 8, 8 )
|
cell_size = Vector2( 8, 8 )
|
||||||
collision_layer = 9
|
collision_layer = 9
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( 327721, 0, 65536, 393257, 0, 65537, 458793, 0, 65537, 524329, 0, 65537, 589865, 0, 65537, 655401, 0, 65537, 720937, 0, 65537, 786445, 0, 65536, 786473, 0, 65537, 851981, 0, 65537, 852009, 0, 65538, 917517, 0, 65537, 983053, 0, 65537, 1048589, 0, 65537, 1114125, 0, 65537, 1179661, 0, 65537, 1245197, 0, 65537 )
|
tile_data = PoolIntArray( 524329, 0, 65536, 589865, 0, 65537, 655401, 0, 65537, 720937, 0, 65537, 786445, 0, 65536, 786473, 0, 65537, 851981, 0, 65537, 852009, 0, 65538, 917517, 0, 65537, 983053, 0, 65537, 1048589, 0, 65537, 1114125, 0, 65537, 1179661, 0, 65537, 1245197, 0, 65537 )
|
||||||
|
|
||||||
[node name="Death" type="TileMap" parent="." groups=["death"]]
|
[node name="Death" type="TileMap" parent="." groups=["death"]]
|
||||||
light_mask = 0
|
light_mask = 0
|
||||||
|
@ -110,8 +110,8 @@ position = Vector2( 104, 96 )
|
||||||
scale = Vector2( 1, 8 )
|
scale = Vector2( 1, 8 )
|
||||||
|
|
||||||
[node name="Ladder2" parent="Environment" instance=ExtResource( 9 )]
|
[node name="Ladder2" parent="Environment" instance=ExtResource( 9 )]
|
||||||
position = Vector2( 328, 40 )
|
position = Vector2( 328, 64 )
|
||||||
scale = Vector2( 1, 9 )
|
scale = Vector2( 1, 6 )
|
||||||
|
|
||||||
[node name="Stalactite" parent="Environment" instance=ExtResource( 3 )]
|
[node name="Stalactite" parent="Environment" instance=ExtResource( 3 )]
|
||||||
position = Vector2( 64, 16 )
|
position = Vector2( 64, 16 )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
onready var cast = $RayCast2D
|
onready var cast = $RayCast2D
|
||||||
export var fall_speed = 60
|
export var fall_speed = 100
|
||||||
var fall = false
|
var fall = false
|
||||||
onready var refresh_timer = $RefreshTimer
|
onready var refresh_timer = $RefreshTimer
|
||||||
onready var anims = $AnimationPlayer
|
onready var anims = $AnimationPlayer
|
||||||
|
@ -15,8 +15,7 @@ func _physics_process(delta):
|
||||||
if cast.is_colliding():
|
if cast.is_colliding():
|
||||||
var collider = cast.get_collider()
|
var collider = cast.get_collider()
|
||||||
if collider.is_in_group("player_hitbox") or collider.is_in_group("msx"):
|
if collider.is_in_group("player_hitbox") or collider.is_in_group("msx"):
|
||||||
if fall == false: refresh_timer.start()
|
anims.play("wiggle")
|
||||||
fall = true
|
|
||||||
|
|
||||||
if fall == true:
|
if fall == true:
|
||||||
position.y += fall_speed * delta
|
position.y += fall_speed * delta
|
||||||
|
@ -36,3 +35,9 @@ func _on_RefreshTimer_timeout():
|
||||||
fall = false
|
fall = false
|
||||||
anims.play("idle")
|
anims.play("idle")
|
||||||
anims.play("disappear", -1, -1.0, true)
|
anims.play("disappear", -1, -1.0, true)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||||
|
if anim_name == "wiggle":
|
||||||
|
if fall == false: refresh_timer.start()
|
||||||
|
fall = true
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://graphics/stalactite/stalactite.png" type="Texture" id=1]
|
[ext_resource path="res://graphics/stalactite/stalactite.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://objects/environment/stalactite/stalactite.gd" type="Script" id=2]
|
[ext_resource path="res://objects/environment/stalactite/stalactite.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 4, 5 )
|
extents = Vector2( 4, 2.5 )
|
||||||
|
|
||||||
[sub_resource type="Animation" id=4]
|
[sub_resource type="Animation" id=4]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
|
@ -101,6 +101,23 @@ tracks/2/keys = {
|
||||||
"values": [ false ]
|
"values": [ false ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=5]
|
||||||
|
resource_name = "wiggle"
|
||||||
|
length = 0.1
|
||||||
|
step = 0.025
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("Sprite:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 4, 3 ), Vector2( 3, 3 ), Vector2( 4, 3 ), Vector2( 5, 3 ), Vector2( 4, 3 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Stalactite" type="Node2D"]
|
[node name="Stalactite" type="Node2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
@ -129,10 +146,12 @@ autoplay = "idle"
|
||||||
anims/RESET = SubResource( 4 )
|
anims/RESET = SubResource( 4 )
|
||||||
anims/disappear = SubResource( 2 )
|
anims/disappear = SubResource( 2 )
|
||||||
anims/idle = SubResource( 3 )
|
anims/idle = SubResource( 3 )
|
||||||
|
anims/wiggle = SubResource( 5 )
|
||||||
|
|
||||||
[node name="RefreshTimer" type="Timer" parent="."]
|
[node name="RefreshTimer" type="Timer" parent="."]
|
||||||
wait_time = 2.0
|
wait_time = 2.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||||
|
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
||||||
[connection signal="timeout" from="RefreshTimer" to="." method="_on_RefreshTimer_timeout"]
|
[connection signal="timeout" from="RefreshTimer" to="." method="_on_RefreshTimer_timeout"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue