Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Lazyworker |
I tried search some doc about that, but I can’t saw anyone
I want to random popup skill when levelup for roguelike game
my code is :
#gobal var
str = 1
agi = 2
var sk1 = [str,1]
var sk2 = [agi,2]
#on scren
var array = [sk1,sk2]
array.shuffle()
rngsk = array.pop_front() #pop sk1
rngsk[0] = rngsk[0] +rngsk[1]
# str = str + 1
print(str) # = 2
How to do it.
Thank you
What’s the actual problem you’re trying to tackle with all of the array gymnastics? With a better explanation of the problem (not the potential solution you outline above), there’s likely a better solution.
jgodfrey | 2022-04-21 21:40
I’m updated my problem, it’s OK ?
thank for recommend.
Lazyworker | 2022-04-22 02:07
Your update is better, but it’d be nice to have a better description of what exactly you’re trying to create - NOT the code you think will do it. For example, you mention a random popup skill for a roguelike game. That’s a good start. Provide some more detail there. How do you want it to work? What should it do exactly? What are you trying to randomize?
Again, I don’t think you’re on the right path with your example code, so just ignore that for now. Try to describe what you’re trying to make, in as much detail as possible…
jgodfrey | 2022-04-22 15:52