extends Node # Event Handler for Moving # Variable var topic = "moved" var positions = [] func _arrived(_character): return false # are positions the same? func compare_pos(): var p1 = positions[0] for p in positions: if p != p1: return false # moving return true # not moving func _reached(_character): return false func track_pos(new_pos): positions.append(new_pos) if len(positions) > 50: positions.pop_front() # Handle func handle(character): return # var current_pos = character.get_gpos() # track_pos(current_pos) # if _arrived(character): # character.think("Moved/Arrived") # character.emit_signal("arrived") # return # elif _reached(character): # character.think("Moved/Reached Dot") # character.emit_signal("reached") # return # elif compare_pos(): # character.think("Moved/Not Moving") # character.emit_signal("not_moving") # return #elif character.get_internal_velocity() != Vector2(0.0,0.0) and character.get_velocity() != character.get_internal_velocity(): # var sdfoia = character.get_internal_velocity() # var posjk = character.get_velocity() # character.think("Moved/Wrong Directiaon") # character.emit_signal("wrong_direction") #else: # return