Ms.X now plays the give animation when spawning a shard
This commit is contained in:
parent
1ae04b7368
commit
84c92ac4b7
2 changed files with 23 additions and 8 deletions
|
@ -21,7 +21,7 @@ func _physics_process(delta):
|
|||
velocity = move_and_slide_with_snap(velocity, Vector2.DOWN, Vector2.UP, true)
|
||||
#Anims
|
||||
if velocity.x == 0:
|
||||
anims.play("idle")
|
||||
if !anims.get_current_animation() == "give": anims.play("idle")
|
||||
else:
|
||||
anims.play("walk")
|
||||
#Stop at the end of path and give shard
|
||||
|
@ -30,13 +30,14 @@ func _physics_process(delta):
|
|||
velocity.x = 0
|
||||
if is_holding_shard:
|
||||
anims.play("give")
|
||||
var ShardInstance = shard.instance()
|
||||
ShardInstance.global_position = Vector2(shard_position.global_position.x,shard_position.global_position.y)
|
||||
ShardInstance.number = 1
|
||||
get_owner().add_child(ShardInstance)
|
||||
is_holding_shard = false
|
||||
|
||||
|
||||
func spawn_shard():
|
||||
var ShardInstance = shard.instance()
|
||||
ShardInstance.global_position = Vector2(shard_position.global_position.x,shard_position.global_position.y)
|
||||
ShardInstance.number = 1
|
||||
get_owner().add_child(ShardInstance)
|
||||
is_holding_shard = false
|
||||
|
||||
func switch_action():
|
||||
is_moving = true
|
||||
|
||||
|
|
|
@ -87,6 +87,20 @@ tracks/2/keys = {
|
|||
"update": 1,
|
||||
"values": [ 0, 1, 0 ]
|
||||
}
|
||||
tracks/3/type = "method"
|
||||
tracks/3/path = NodePath(".")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0.18 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "spawn_shard"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "idle"
|
||||
|
@ -203,7 +217,7 @@ hframes = 2
|
|||
region_rect = Rect2( 0, 0, 20, 20 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["msx", "player_hitbox"]]
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox", "msx", "player_hitbox"]]
|
||||
position = Vector2( 0, 3 )
|
||||
collision_layer = 11
|
||||
collision_mask = 33
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue