Flopsy/objects/characters/monsters/03/bullet.gd

21 lines
396 B
GDScript3
Raw Normal View History

2022-07-19 22:22:16 +02:00
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()