C
Cofefe
Guest
Hi all!
So today I thought I'd try something with Switch statements, I figured it wouldn't work but I didn't expect the error I got. All I did was put the "Or" Operator in the cases (||). You can see the code below:
And the compile error I got:
As you can see, it is not a duplicate case statement. So, IDK why I got this error.
I'm just gonna replace that with if statements, like I had before, but if somebody could explain this to me I'm interested, or if its a bug I can report it. Thanks!
So today I thought I'd try something with Switch statements, I figured it wouldn't work but I didn't expect the error I got. All I did was put the "Or" Operator in the cases (||). You can see the code below:
Code:
///@description horizontal_tile_collisions()
var grounded = tile_place_below(tile, 1);
x += xsp;
if(xsp > 0)
{
switch(tile_place_right(tile, 0))
{
case 0:
//Nothing
break;
case (1 || 2 || 4 || 5):
x = (bbox_right & ~15) - 1 - sprite_bbox_right;
xsp = 0;
break;
case (3 || 6 || 7):
y = (bbox_bottom & ~15) - sprite_bbox_bottom;
break;
}
if(grounded != 0) && (tile_place_below(tile, 1) = 0) && (tile_place_below(tile, xsp) = 0) y += xsp;
}
if(xsp < 0)
{
switch(tile_place_left(tile, 0))
{
case 0:
//Nothing
break;
case (1 || 3 || 6 || 7):
x = ((bbox_left + 16) & ~15) + 1 - sprite_bbox_left;
xsp = 0;
break;
case (2 || 4 || 5):
y = (bbox_bottom & ~15) - sprite_bbox_bottom;
break;
}
if(grounded != 0) && (tile_place_below(tile, 1) = 0) && (tile_place_below(tile, -xsp) = 0) y -= xsp;
}
Code:
Script: horizontal_tile_collisions at line 18 : duplicate case statement found
Script: horizontal_tile_collisions at line 13 : original here
Script: horizontal_tile_collisions at line 37 : duplicate case statement found
Script: horizontal_tile_collisions at line 32 : original here
I'm just gonna replace that with if statements, like I had before, but if somebody could explain this to me I'm interested, or if its a bug I can report it. Thanks!