Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ROBOTOO007 |
HEY! i have a function trying to give a random number between 0 and the size on an array
for some reason it always prints out 39 (the array size is 64) here’s the code:
func gunspawner():
for x in range(global.map_size.x):
for y in range(global.map_size.y):
if global.map[x][y] == global.EMPTY:
available_slots_spawns.append([x,y])
var choose_place = int(rand_range(0,available_slots_spawns.size()))
print(choose_place)
gun.position = Vector2(global.map_coord[available_slots_spawns[choose_place][0]][available_slots_spawns[choose_place][1]])
add_child(gun)
checkForWeapons()
thanks for taking the time to look at my code
PLEASE HELP!!!