Ms.X now plays the give animation when spawning a shard

This commit is contained in:
pennyrigate 2023-05-17 01:58:37 -04:00
parent 1ae04b7368
commit 84c92ac4b7
2 changed files with 23 additions and 8 deletions

View file

@ -21,7 +21,7 @@ func _physics_process(delta):
velocity = move_and_slide_with_snap(velocity, Vector2.DOWN, Vector2.UP, true) velocity = move_and_slide_with_snap(velocity, Vector2.DOWN, Vector2.UP, true)
#Anims #Anims
if velocity.x == 0: if velocity.x == 0:
anims.play("idle") if !anims.get_current_animation() == "give": anims.play("idle")
else: else:
anims.play("walk") anims.play("walk")
#Stop at the end of path and give shard #Stop at the end of path and give shard
@ -30,13 +30,14 @@ func _physics_process(delta):
velocity.x = 0 velocity.x = 0
if is_holding_shard: if is_holding_shard:
anims.play("give") anims.play("give")
func spawn_shard():
var ShardInstance = shard.instance() var ShardInstance = shard.instance()
ShardInstance.global_position = Vector2(shard_position.global_position.x,shard_position.global_position.y) ShardInstance.global_position = Vector2(shard_position.global_position.x,shard_position.global_position.y)
ShardInstance.number = 1 ShardInstance.number = 1
get_owner().add_child(ShardInstance) get_owner().add_child(ShardInstance)
is_holding_shard = false is_holding_shard = false
func switch_action(): func switch_action():
is_moving = true is_moving = true

View file

@ -87,6 +87,20 @@ tracks/2/keys = {
"update": 1, "update": 1,
"values": [ 0, 1, 0 ] "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] [sub_resource type="Animation" id=4]
resource_name = "idle" resource_name = "idle"
@ -203,7 +217,7 @@ hframes = 2
region_rect = Rect2( 0, 0, 20, 20 ) region_rect = Rect2( 0, 0, 20, 20 )
script = ExtResource( 12 ) 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 ) position = Vector2( 0, 3 )
collision_layer = 11 collision_layer = 11
collision_mask = 33 collision_mask = 33