setstate on guest

This commit is contained in:
mightypanders 2021-06-30 20:28:47 +02:00
parent 3214bc1f03
commit 56441d0129
2 changed files with 18 additions and 15 deletions

View File

@ -45,32 +45,35 @@ var follow_node = null
var follow_guest = null
var follow_pos = global_position
func set_state(state):
if state == states.delivered:
pickUpArea.monitorable = false
pickUpArea.monitoring = false
collision.disabled = true
if state == states.waiting:
collision.disabled = false
mode = RigidBody2D.MODE_KINEMATIC
if state == states.tethered:
collision.disabled = false
mode = RigidBody2D.MODE_STATIC
func _physics_process(delta):
#linear_velocity = linear_velocity.clamped(100)
if currentState == states.waiting:
linear_velocity.move_toward(Vector2.ZERO,5.0)
collision.disabled = false
elif currentState == states.tethered:
collision.disabled = true
mode = RigidBody2D.MODE_STATIC
var rot_dir = get_angle_to(follow_pos)
rotation += (rot_dir + deg2rad(90))*0.2
var distance = follow_pos.distance_to(global_position)
global_position = follow_pos
pass
elif currentState == states.delivered:
pickUpArea.monitorable = false
pickUpArea.monitoring = false
collision.disabled = true
func _process(delta):
if delivered != null and OS.get_system_time_msecs() - delivered > 1000:
queue_free()
if visible == false:
follow_node = self
if delivered == null:

View File

@ -109,10 +109,10 @@ func remove_Guests_from_Line(color):
func _on_PickupCheckArea_area_entered(area):
if area.get_parent().is_in_group("DropOffPoint"):
print("It's a DOP")
#print("It's a DOP")
var dop = area.get_parent()
var color = dop.destinationColor
print(color)
#print(color)
last_in_line = remove_Guests_from_Line(color)
#drop all guests after first guest.color == DOP.color, also vanish all guests.color == DOP.color
pass
@ -124,10 +124,10 @@ func _on_PickupCheckArea_area_entered(area):
#print("We already have you in line")
pass
else:
print("Area has parent %s" % area.get_parent())
print("It's a Guest")
#print("Area has parent %s" % area.get_parent())
#print("It's a Guest")
last_in_line = add_Guest_to_Line(last_in_line,area.get_parent())
print(last_in_line)
#print(last_in_line)
print(guests)