18 lines
491 B
GDScript
18 lines
491 B
GDScript
extends Area2D
|
|
|
|
@export var speed = 800.0 # Peluru musuh Shiro buat agak lambat biar bisa dihindari
|
|
var direction = Vector2.LEFT # Musuh nembak ke Kiri
|
|
var damage : float = 0.0 # Akan diisi oleh mobil musuh (0.2)
|
|
|
|
func _physics_process(delta):
|
|
position += direction * speed * delta
|
|
|
|
func _on_body_entered(body):
|
|
# Khusus melukai Player
|
|
if body.has_method("terima_damage"):
|
|
body.terima_damage(damage)
|
|
queue_free()
|
|
|
|
func _on_visible_on_screen_notifier_2d_screen_exited():
|
|
queue_free()
|