C
Capptianm
Guest
I read the documentation for the switch functions and tried to use it like this:
This, however, doesn't work. every line with a case on it returns "Case argument should be a constant" and I'm not sure what that means. Can anyone point me in the right direction?
Code:
switch(dir = irandom_range(1, 4))
{
case dir = 1:
if (collision_point(x + 32, y, obj_floor, true, true))
{
break
}
x += 32
case dir = 2:
if (collision_point(x - 32, y, obj_floor, true, true))
{
break
}
x -= 32
case dir = 3:
if (collision_point(x, y + 32, obj_floor, true, true))
{
break
}
y += 32
case dir = 4:
if (collision_point(x, y - 32, obj_floor, true, true))
{
break
}
y -= 32
}