fuzzyworld

godot-shooter / meteor / files / MeteorLarge.gd

Branch meteor · default branch · all branches

MeteorLarge.gd

398 B · history · blame

1extends KinematicBody2D
2
3export var health = 5
4export var max_health = 5
5export var size = 1
6export var velocity: Vector2 = Vector2(1,1).normalized()
7
8func _ready() -> void:
9 scale = Vector2(size, size)
10
11func hurt(damage: int = 1) -> void:
12 health -= 1
13 if health <= 0:
14 kill()
15
16func kill() -> void:
17 queue_free()
18
19func _physics_process(delta: float) -> void:
20 velocity = move_and_slide(velocity)