Projectiles do damage
This commit is contained in:
parent
1e9336a11d
commit
7faf33349c
|
@ -8,6 +8,7 @@ var health = 5
|
|||
const UP = Vector2(0, -1)
|
||||
|
||||
var velocity = Vector2()
|
||||
|
||||
func get_type():
|
||||
return "enemy"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ class_name Projectile
|
|||
export var speed = 300
|
||||
var velocity = Vector2.ZERO
|
||||
var energy_cost = 1
|
||||
var damage = 1
|
||||
onready var Hit = get_node("Node/Hit")
|
||||
onready var Hit_Wall = get_node("Node/Hit Wall")
|
||||
|
||||
|
@ -17,4 +18,8 @@ func launch(wand, effect):
|
|||
return energy_cost
|
||||
|
||||
func on_impact(collision):
|
||||
if collision.collider.has_method("get_type") && collision.collider.get_type() == "enemy":
|
||||
var c = collision.collider
|
||||
print(c.health)
|
||||
c.health -= damage
|
||||
queue_free()
|
||||
|
|
|
@ -100,6 +100,7 @@ texture={
|
|||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
|
|
Loading…
Reference in a new issue