Basically what the title says. I am trying to make a boss for my game .He would have 3 variables and they would be set to false. Every X seconds he would chose one at random and make it true. When a variable is set to true he would preform an attack and then set it to false again. Each variable would represent a different attack of course.
So have can I do it? Thanks in advance.
Develop games in your browser. Powerful, performant & highly capable.
It doesn't work like this.
if 1: set var 1 = true
else if 2: set var 2 = true
else if 3: set var 3 = true
and since thats not really practical, it makes more sense to program it another way, maybe like this:
every x seconds: attacktype = choose(1,2,3)
if attacktype (not equal) 0:
(ofc you can also use strings instead of 1, 2, 3, ...)
Which action do I use for "choose"
Or instead of setting booleans, couldn't you set a numerical value to your variable?
Boss -> set attackType to int(random(1,3))
if attackType == 1 do…
elseif attackType == 2 do…
elseif attackType == 3 do…
I don't know if it could help you, but you can take a look to the switch plugin :
Thanks for the help guys, I did it, it needs some polishing but it works like this:
Every X seconds- Boss/ add choose (1,2,3,4) to Attack
Attack=1-Set animation 1,set Attack to 0
Attack=2-Set animation 2,set Attack to 0
Attack=3-Set animation 3,set Attack to 0
Attack=4-Set animation 4,set Attack to 0
Oh, I misread mindfaQ message, I was writing some or less the same thing.