add player bounce when killing enemy
This commit is contained in:
@@ -271,6 +271,7 @@ animation_player = NodePath("../AnimationPlayer")
|
||||
animation_name = "die"
|
||||
animated_sprite = NodePath("../AnimatedSprite2D")
|
||||
animated_sprite_name = "die"
|
||||
player_bounce = -200
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBox"]
|
||||
position = Vector2(0, -11)
|
||||
|
||||
@@ -6,6 +6,11 @@ extends Area2D
|
||||
@export var animated_sprite: AnimatedSprite2D
|
||||
@export var animated_sprite_name: String
|
||||
|
||||
func _on_body_entered(_body: Node2D) -> void:
|
||||
@export var player_bounce: int
|
||||
|
||||
func _on_body_entered(player_body: Node2D) -> void:
|
||||
var player_character_body = player_body as CharacterBody2D
|
||||
player_character_body.velocity.y = player_bounce
|
||||
|
||||
animated_sprite.play(animated_sprite_name)
|
||||
animation_player.play(animation_name)
|
||||
|
||||
Reference in New Issue
Block a user