Hi everyone and Gernot
i was coding a game, when it stopped compiling because an IF didn´t had ENDIF
i searched for the error, but couldn´t find it and couldn´t fix it since the ENDIF was there...
here´s the piece of code where the bug lays:
SUB fin3:
IF my-10 > y3-1 AND my+71 > y3+60
CLEARSCREEN RGB(149,0,0)
PRINT "GAME OVER", sx/2-20,sy/2
ENDIF
ENDSUB
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:71fa70a5 - 3D, NET
"TEST2.gbas"(77) error : IF without ENDIF / THEN
i though it was my fault, but now i think this is a bug of GLBasic..
¿What do you think?
Code runs fine for me, check higher up in your program so all loops, functions and if/else are terminated.
Ya, your problem is most likely above this code.
Also, this line:
IF my-10 > y3-1 AND my+71 > y3+60
I didn't even know that was allowed!
I've never done it that way . . . ever.
It is difficult to read and debug.
Doesn't this do the same?:
IF my > y3-1+10 AND my > y3+60-71
[Edit] You could also make it clearer by using more descriptive variables or constants for those values, such as (I just made them up as I have no idea what the numbers actually represent):
IF player_y > floor_y-1 + floor_thickness AND player_y > floor_y + player_height - jump_height
thank you, i found it was my fault :0
i leaved an IF without ENDIF above the code i posted, (you were right!)
thank you for your replies!
We were right because the same has happened to all of us :-)