guest immediately knows when they are picked up
This commit is contained in:
parent
86b9cb492e
commit
e6626fe60d
41
Guest.gd
41
Guest.gd
|
@ -15,6 +15,10 @@ var rng = RandomNumberGenerator.new()
|
||||||
onready var sprite = $Sprite
|
onready var sprite = $Sprite
|
||||||
onready var exclusionZoneShape = $ExclusionZone/CollisionShape2D
|
onready var exclusionZoneShape = $ExclusionZone/CollisionShape2D
|
||||||
|
|
||||||
|
enum states {
|
||||||
|
waiting,
|
||||||
|
tethered
|
||||||
|
}
|
||||||
var colorList = [
|
var colorList = [
|
||||||
Color.yellow,
|
Color.yellow,
|
||||||
Color.violet,
|
Color.violet,
|
||||||
|
@ -22,32 +26,43 @@ var colorList = [
|
||||||
Color.turquoise,
|
Color.turquoise,
|
||||||
Color.orange
|
Color.orange
|
||||||
]
|
]
|
||||||
|
var names = [
|
||||||
|
'Dieter',
|
||||||
|
'Peter',
|
||||||
|
'Gabi',
|
||||||
|
'Ursula',
|
||||||
|
'Manni',
|
||||||
|
'Karl',
|
||||||
|
'Christa',
|
||||||
|
'Britta'
|
||||||
|
]
|
||||||
|
var currentState = states.waiting
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
linear_velocity = linear_velocity.clamped(100)
|
||||||
|
if currentState == states.waiting:
|
||||||
|
linear_velocity.move_toward(Vector2.ZERO,5.0)
|
||||||
|
elif currentState == states.tethered:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
||||||
#print(get_tree().get_root().get_node("Playa"))
|
|
||||||
#connect('picked_up',get_tree().get_nodes_in_group("Player")[0], '_on_Guest_picked_up')
|
|
||||||
|
|
||||||
rng.randomize()
|
rng.randomize()
|
||||||
var n = rng.randi_range(0,4)
|
var n = rng.randi_range(0,4)
|
||||||
#print(n)
|
|
||||||
destinationColor = colorList[n]
|
destinationColor = colorList[n]
|
||||||
#print(destinationColor)
|
|
||||||
sprite.modulate = destinationColor
|
sprite.modulate = destinationColor
|
||||||
|
var m = rng.randi_range(0,names.size()-1)
|
||||||
|
guestName = names[m]
|
||||||
|
|
||||||
func _on_PickUpArea_body_entered(body):
|
func _on_PickUpArea_body_entered(body):
|
||||||
print(body.name)
|
print(body.name)
|
||||||
if body.name == "Playa":
|
if body.name == "Playa":
|
||||||
print(body.velocity.length())
|
|
||||||
if body.velocity.length() <= PICKUPTRESHOLD:
|
|
||||||
emit_signal("picked_up",destinationColor,guestName)
|
|
||||||
pickup_time = OS.get_system_time_msecs()
|
pickup_time = OS.get_system_time_msecs()
|
||||||
|
emit_signal("picked_up",destinationColor,guestName)
|
||||||
# start pickup process
|
# start pickup process
|
||||||
|
|
||||||
# we are being picked up by the player
|
# we are being picked up by the player
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _on_PickUpArea_area_entered(area):
|
func _on_PickUpArea_area_entered(area):
|
||||||
|
|
Loading…
Reference in New Issue