system
1
system
4
|
|
|
 |
Reply From: |
deathvulture |
Hey!
Check if this answer your question
https://forum.godotengine.org/2539/how-would-i-go-about-picking-a-random-number
thanks, but i am kinda a noob. i have no idea what there talking about.
dezekeerjoran | 2016-12-22 12:54
Hmmm i think you should do this tutorial first but i’ll try to help you.
First you need to create a button, then add a script and put this inside
extends Button
func _ready():
connect("pressed",self,"_random")
func _random():
randomize()
set_text(str(round(rand_range(0,10))))
In the ready function you connect the pressed state with the _random function.
randomize() change the seed which will generate the random number.
And the last line set the button text with a random number from 0 to 10.
Hope it helps!
deathvulture | 2016-12-22 16:24
thank you, now it works.
dezekeerjoran | 2016-12-22 18:24