all is in the question, how can i coding that an enemy choose randomly between several patterns, example, he have two different attacks and he choose at random between them, i see the expression "choose" but i think i cant use that, i was thinking something like :
function 1 = first attack pattern
function 2 = second attack pattern
anbd expression choose (functiin1, function 2) but the expression choose is just for parameters not function i guess.
"choose(a, b [, c...])
Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two."
Ty for help.
Try that I think random behavior or object type :), might work not garenteed though sorry...
I don't know what do you mean by "random behavior" or "object type"
Develop games in your browser. Powerful, performant & highly capable.
I found this solution who works, if somoene have better tell me :) :
I'm still a newbie, but my first thought would be to put the variable 'AttackPattern' as a variable on the monster sprite itself, instead of as a global number, just to clean things up a little.
That way you might be able to have more than one monster?