Topic was automatically imported from the old Question2Answer platform.
Asked By
gonzalezharry
So I’m trying to use randi() in a global variable. ready() prints always the same value. (Note that when uncommenting the second line inside of ready() it does print a random one)
Already tried without the “onready” preffix. Nothing works.
extends Node
var max_multiplier = 5
#This variable has to dynamically change during the game
var current_base = 4
onready var tiles_goal = current_base * (randi() % max_multiplier + 1)
func _ready():
randomize()
#tiles_goal = current_base * (randi() % max_multiplier + 1)
print(tiles_goal)