Commit c6636bde authored by Ethan Huneke's avatar Ethan Huneke
Browse files

Update Player.gd

Health and dash
parent c8dfbb17
extends Area2D
onready var ray = $RayCast2D
var dashCharges = 2
var dashRange = 1
var tile_size = 16
var inputs = {"right": Vector2.RIGHT,
"left": Vector2.LEFT,
......@@ -26,8 +27,11 @@ func move(dir: String):
ray.force_raycast_update()
if !ray.is_colliding():
if(not get_node("..").is_actor_dir(name, dir)):
position += inputs[dir] * tile_size
action_taken = true
position += inputs[dir] * tile_size * dashRange
if dashRange != 1:
dashCharges -= 1
dashRange = 1
action_taken = true
else:
print("-Actor Collision: "+get_node("..").get_actor_id_dir(name, dir))
else:
......@@ -45,6 +49,24 @@ func life_update():
# kill()
get_node("..").kill(name)
func _input(ev):
if Input.is_key_pressed(KEY_SPACE):
if dashCharges > 0:
if dashRange == 1:
dashRange = 2
else:
dashRange = 1
func _draw():
var label = Label.new()
var font = label.get_font('')
label.queue_free()
draw_string(font, Vector2(OS.window_size.x/5.5, OS.window_size.y/5), 'Dashes: ' + str(dashCharges), Color(1.0, 1.0, 0.0, 1.0))
draw_string(font, Vector2(OS.window_size.x/5.5, OS.window_size.y/4), 'Health: ' + str(health),Color(1.0, 1.0, 0.0, 1.0))
func _process(_delta):
update()
#func kill():
# print(">" + self.name + " is dying.")
# get_node("../../TurnManager/OrderManager").remove_actor(self.name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment