forked from devinapgames/FutureBall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlobal_vars.gd
48 lines (43 loc) · 1.04 KB
/
Global_vars.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
extends Node2D
const SPEED = 60
const GRAVITY = 10
const JUMP_POWER = -250
const FLOOR = Vector2(0,-1)
var Winner
var ball
var empate = []
var timer_out = false
var camara = Rect2(0,0,0,0)
var zoom = Vector2(1,1)
func _ready():
pass
func _process(delta):
pass
func WinScreen(var player):
if timer_out:
var mejor = -100
for i in PlayerGlobals.Players:
if mejor < i.Points:
Winner = i
empate.append(i)
elif mejor == i.Points:
empate.append(i)
Winner = player
get_tree().change_scene("res://Winscreen.tscn")
func spawnBall():
for i in get_tree().get_nodes_in_group("Ball"):
i.queue_free()
ball = preload("res://Bola.tscn").instance()
var ball_spawns = get_tree().get_nodes_in_group("Ball spawn")
var length = ball_spawns.size()
var a = []
for j in range(length):
a.append(j)
var random = randi()%a.size()
var spawn_p = ball_spawns[a[random]].get_global_position()
ball.global_position = spawn_p
add_child(ball)
func KillProps():
for i in get_tree().get_nodes_in_group("Remove"):
remove_child(i)
i.queue_free()