enumeration + random in array
#1

why cant we do:

Код:
enum e_Mode {
e_Mode_Spawn1[3],
e_Mode_Spawn2[3],
e_Mode_Spawn3[3],
}

static array[2][e_Mode];

array[0][e_Mode_Spawn1 + random(3)]
any valid reason
Reply
#2

It works, but you must keep the tags.

Код:
array[0][e_Mode:(_:e_Mode_Spawn1 + random(3))]
This will randomize between e_Mode_Spawn1, e_Mode_Spawn2 and e_Mode_Spawn3.

But if you only have 3 coords in an array there is not really any point in using an enum. Just use a regular array with Float tag.

Actually what you wrote works too, but will give a warning.
Reply
#3

why do you want to make this code so hard, it just 3 dimensional array nothing special.
new array[2][3][3],rnd=random(3);

array[0][rnd][0]
array[0][rnd][1]
array[0][rnd][2]

every part of your code doesnt have to be in enumator
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)