Skip to content

Commit

Permalink
Fixed Wall-Talking Crash
Browse files Browse the repository at this point in the history
Now nothing would happen if you try to talk to a wall.
  • Loading branch information
mechPenSketch committed Sep 8, 2021
1 parent c623f31 commit 1771c30
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions addons/jrpg_overwolrd/nodes/event.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ func _action():
var collider = raycast.get_collider()
if collider:

# GET COLLIDER TO TURN TO PLAYER
var dir_v = Vector2()
var collider_position = collider.get_position()
for i in 2:
if position[i] < collider_position[i]:
dir_v[i] = -1
elif position[i] > collider_position[i]:
dir_v[i] = 1
collider.emit_signal("turning", dir_v)
# COLLIDER SHOULD BE AN EVENT
if collider.get_class() == "Event":

collider.activate_dialog()
# GET COLLIDER TO TURN TO PLAYER
var dir_v = Vector2()
var collider_position = collider.get_position()
for i in 2:
if position[i] < collider_position[i]:
dir_v[i] = -1
elif position[i] > collider_position[i]:
dir_v[i] = 1
collider.emit_signal("turning", dir_v)

collider.activate_dialog()

func _direction(dir:Vector2):
if !get_tree().is_paused() and !is_moving:
Expand Down Expand Up @@ -132,6 +135,9 @@ func activate_dialog():

new_dialog.connect("timeline_end", controller, "_end_of_dialog")

func get_class():
return "Event"

func get_default_texture_filepath():
return "res://addons/jrpg_overwolrd/nodes/event.svg"

Expand Down

0 comments on commit 1771c30

Please sign in to comment.