Files
brackeys-knight/scripts/hit_box.gd

17 lines
466 B
GDScript

extends Area2D
@export var animation_player: AnimationPlayer
@export var animation_name: String
@export var animated_sprite: AnimatedSprite2D
@export var animated_sprite_name: String
@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)