first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
31
scenes/obstacle/obstacle.gd
Normal file
31
scenes/obstacle/obstacle.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
class_name Obstacle extends CharacterBody2D
|
||||
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var lifeTimeTimer = $lifeTimeTimer
|
||||
|
||||
@export var damage: int = 10
|
||||
@export var health: int = 1
|
||||
@export var minHealth: int = 1
|
||||
@export var maxHealth: int = 1
|
||||
@export var lifeTime: int = 600
|
||||
|
||||
func _ready() -> void:
|
||||
lifeTimeTimer.start(lifeTime)
|
||||
health += damage
|
||||
|
||||
func spawn(damage: int):
|
||||
pass
|
||||
|
||||
|
||||
func _on_hurt_area_hurt(amount: int) -> void:
|
||||
hurt(amount)
|
||||
|
||||
func hurt(amount: int):
|
||||
if health - amount <= minHealth:
|
||||
queue_free()
|
||||
else:
|
||||
health -= amount
|
||||
|
||||
|
||||
func _on_life_time_timer_timeout() -> void:
|
||||
queue_free()
|
||||
Loading…
Add table
Add a link
Reference in a new issue