[EDIT] bug fix and final push

This commit is contained in:
baldas_h 2020-04-05 19:05:05 +02:00
parent d4ac689cb7
commit 44e8d7c60e
4 changed files with 18 additions and 4 deletions

View File

@ -68,11 +68,11 @@ margin_left = 1300.0
margin_right = 1300.0
[node name="Player1" parent="." instance=ExtResource( 2 )]
position = Vector2( 292.436, 346.549 )
position = Vector2( 1610.2, 283.082 )
z_index = 10
[node name="Player2" parent="." instance=ExtResource( 2 )]
position = Vector2( 1604.59, 344.539 )
position = Vector2( 291.832, 282.743 )
z_index = 10
[node name="GameManager" parent="." instance=ExtResource( 5 )]

View File

@ -211,7 +211,7 @@ _data = {
}
[node name="KinematicBody2D" type="KinematicBody2D" groups=[
"Player",
"player",
]]
script = ExtResource( 2 )
slow_cooldown = 3

View File

@ -9,6 +9,7 @@
extents = Vector2( 88.8117, 26.2111 )
[node name="SlowTrail" type="Node2D"]
scale = Vector2( 2, 1 )
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]

View File

@ -1,14 +1,27 @@
extends Node2D
onready var spawnPoints = get_tree().get_nodes_in_group("spawn_point")
onready var tmpSpawnPoints = get_tree().get_nodes_in_group("spawn_point")
var prevSpawnPoint = null
var bucket = load("res://Scene/Clopinette.tscn")
func _ready():
tmpSpawnPoints.shuffle()
func spawnBucket():
var newBucket = bucket.instance()
if tmpSpawnPoints.size() == 0:
tmpSpawnPoints = [] + spawnPoints
tmpSpawnPoints.shuffle()
var newSpawnPoint = tmpSpawnPoints[randi() % tmpSpawnPoints.size()]
self.get_parent().add_child(newBucket)
newBucket.add_to_group("bucket")
newBucket.set_position(spawnPoints[randi() % spawnPoints.size()].get_position())
newBucket.set_position(newSpawnPoint.get_position())
tmpSpawnPoints.erase(newSpawnPoint)
func _process(_delta):
if get_tree().get_nodes_in_group("bucket").empty():