Coins system, and finished mortar
This commit is contained in:
@ -4,6 +4,7 @@ var speed = 0
|
||||
var health = 0
|
||||
var shield = 0
|
||||
var damage = 0
|
||||
var value = 0
|
||||
|
||||
var current_health = 0
|
||||
var current_shield = 0
|
||||
@ -12,6 +13,8 @@ var last_position: Vector2 = Vector2.ZERO # for previous position
|
||||
|
||||
static var NAMES = ["Forkman", "Cobold", "Ork"]
|
||||
|
||||
const COIN = preload("res://Game/Accesories/coin.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
last_position = get_parent().position
|
||||
get_node("CharacterBody2D/Area2D").body_entered.connect(Collision_Handler)
|
||||
@ -54,18 +57,21 @@ func set_character_data():
|
||||
health = 100
|
||||
shield = 100
|
||||
damage = 2
|
||||
value = 20
|
||||
"Ork":
|
||||
self.name = "Ork-" + str(randi())
|
||||
speed = 80
|
||||
health = 150
|
||||
shield = 200
|
||||
damage = 5
|
||||
value = 30
|
||||
"Cobold":
|
||||
self.name = "Cobold-" + str(randi())
|
||||
speed = 200
|
||||
health = 50
|
||||
shield = 0
|
||||
damage = 1
|
||||
value = 10
|
||||
|
||||
adjust_speed_of_animation() #adjust animation speed based on the character speed
|
||||
current_health = health
|
||||
@ -117,6 +123,10 @@ func enemy_hurt(amount) -> void:
|
||||
current_health -= amount
|
||||
|
||||
if current_health <= 0:
|
||||
get_parent().get_parent().get_parent().get_node("SidePanel").Update_Coins(value)
|
||||
var coin = COIN.instantiate()
|
||||
coin.position = self.global_position
|
||||
get_parent().get_parent().add_child(coin)
|
||||
get_parent().queue_free()
|
||||
else:
|
||||
adjust_health_bar()
|
||||
|
Reference in New Issue
Block a user