21 lines
396 B
GDScript3
21 lines
396 B
GDScript3
|
extends StaticBody2D
|
||
|
|
||
|
export(Vector2) var velocity
|
||
|
export(int) var damage = 5
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
$Rotation.play("rotate")
|
||
|
$Animation.play("fade")
|
||
|
|
||
|
func _physics_process(delta):
|
||
|
position -= velocity
|
||
|
|
||
|
|
||
|
func _on_PlayerCollision(body):
|
||
|
body.monster_hit(-velocity.x * 10, damage)
|
||
|
queue_free()
|
||
|
|
||
|
func _on_screen_exited():
|
||
|
queue_free()
|