mirror of
https://github.com/mightypanders/GMTKJam2021.git
synced 2025-01-30 21:59:55 +01:00
world receives score signal
This commit is contained in:
parent
31802c51ad
commit
e1fff44040
10
World.gd
10
World.gd
@ -4,6 +4,8 @@ onready var streets = $Streets
|
||||
onready var used_cells = streets.get_used_cells()
|
||||
onready var guests = $Guests
|
||||
|
||||
export var player_score = 0
|
||||
|
||||
var Guest = load("res://Guest.tscn")
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
@ -36,7 +38,7 @@ func create_new_guest():
|
||||
|
||||
while !position_found:
|
||||
if spawn_tries >= MAX_SPAWN_TRIES:
|
||||
print("Max spawn tries reached!")
|
||||
#print("Max spawn tries reached!")
|
||||
return
|
||||
position_found = true;
|
||||
var new_guest_cell = used_cells[rng.randi_range(0, used_cells.size()) -1]
|
||||
@ -52,3 +54,9 @@ func create_new_guest():
|
||||
new_guest.position = new_guest_position;
|
||||
guests.add_child(new_guest)
|
||||
spawn_tries = 0
|
||||
|
||||
|
||||
func _on_Playa_scored(value:int):
|
||||
print('Its a score of %s'% String(value))
|
||||
player_score += value
|
||||
pass # Replace with function body.
|
||||
|
@ -691,5 +691,6 @@ autostart = true
|
||||
[node name="Guest" parent="Guests" instance=ExtResource( 5 )]
|
||||
position = Vector2( 337.119, 100.387 )
|
||||
|
||||
[connection signal="scored" from="Playa" to="." method="_on_Playa_scored"]
|
||||
[connection signal="timeout" from="GuestTimer" to="." method="_on_GuestTimer_timeout"]
|
||||
[connection signal="picked_up" from="Guests/Guest" to="." method="_on_Guest_picked_up"]
|
||||
|
Loading…
Reference in New Issue
Block a user