Godot Version
Question
Hello
I this is what i am traing to do
- generate a random number
- I make a loop that repeats exactly as often as the number
- in the loop I generate a random number between 1 and 0
- then 1 of 4 possibilities should happen all with the same probability
- to check which of the possibilities has happened something is printed
the problem i have is that only the first of the possibilities is printed
this is the cood i use:
func _ready():
var anzal = randi_range(5,16)
print(anzal)
for n in anzal:
var pfeil_richtung = randf()
if pfeil_richtung < 0.25:
print("Links")
elif pfeil_richtung <= 0.25 and pfeil_richtung > 0.50:
print("Rechts")
elif pfeil_richtung <= 0.50 and pfeil_richtung > 0.75:
print("oben")
elif pfeil_richtung <= 0.75 and pfeil_richtung >= 1:
print("Unten")