Commit b55c3a4f authored by dsxfbz's avatar dsxfbz
Browse files

Comments in ActorManager

parent 2e87e7f3
......@@ -13,13 +13,30 @@ var dir_coords = {"right": [1*16, 0],
func _ready():
pass # Replace with function body.
#Purpose: Gets the name of an actor node at the given coordinates
#Inputs:
# >Coordinate pair
#Outputs:
# >If there exists an actor at the coordinates:
# +Return that actor's node name
# >Else:
# +Return placeholder name "NULL"
func get_actor_id_coord(x: int, y: int) -> String:
for actor in get_children():
if(actor.get_position()[0] == x && actor.get_position()[1] == y):
return actor.name
return "NULL"
#Purpose: Gets the name of an actor node at a location relative to another node
#Inputs:
# >currActor: The actor whose location will be used as a reference point for the check
# +location = currActor.location + direction
# >dir: Direction to search in
#Outputs:
# >If there exists an actor at the calculated location:
# +Return that actor's node name
# >Else:
# +Return placeholder name "NULL"
func get_actor_id_dir(currActor: String, dir: String) -> String:
for actor in get_children():
if(actor.get_position()[0] == get_node("./"+currActor).get_position()[0] + dir_coords[dir][0]
......@@ -27,12 +44,30 @@ func get_actor_id_dir(currActor: String, dir: String) -> String:
return actor.name
return "NULL"
#Purpose: Checks if there is an actor at a given set of coordinates
#Inputs:
# >Coordinate pair
#Outputs:
# >If there exists an actor at the coordinates:
# +Return true
# >Else:
# +Return false
func is_actor_coord(x: int, y: int) -> bool:
for actor in get_children():
if(actor.get_position()[0] == x && actor.get_position()[1] == y):
return true
return false
#Purpose: Checks if there is an actor node at a location relative to another node
#Inputs:
# >currActor: The actor whose location will be used as a reference point for the check
# +location = currActor.location + direction
# >dir: Direction to search in
#Outputs:
# >If there exists an actor at the calculated location:
# +Return true
# >Else:
# +Return false
func is_actor_dir(currActor: String, dir: String) -> bool:
print(currActor+" position: ("+String(get_node("./"+currActor).get_position()[0])+", "+String(get_node("./"+currActor).get_position()[0])+")")
for actor in get_children():
......@@ -47,18 +82,36 @@ func is_actor_dir(currActor: String, dir: String) -> bool:
return true
return false
#Purpose: To remove an actor node from the game and adjust scripts to match
#Inputs: Name of actor node
#Outputs: None
func kill(actor: String):
print(">" + actor + " is dying.")
get_node("../TurnManager/OrderManager").remove_actor(actor)
remove_child(get_node(actor))
func knockback(target: String, strength: float, dir: String):
for actor in get_children():
if(actor.name == target):
# Move actor in given direction (dir) stength tiles
# Detect collision; deal damage equal to strength remaining if collides with wall?
break
pass
# # # # #### ### # # ### ### # # ### ###
# # ## # # # ## # # # # # # # #
# # # # # ### # # # # # ## #### ### # #
# # # ## # # # ## # # # # # # #
### # # # ### # # ### ### # # ### ###
#Purpose: To push an actor in a certain direction a given amount, and to apply damage proportionate to the force behind the push
#Inputs:
# target: Name of actor's node being pushed
# strength: Distance (max) being pushed
# dir: Direction of push
# +Change to vector?
#Outputs: None
# +Change to trigger check for death?
#func knockback(target: String, strength: float, dir: String):
# for actor in get_children():
# if(actor.name == target):
## Move actor in given direction (dir) stength tiles
## Detect collision; deal damage equal to strength remaining if collides with wall?
# break
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
......
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