G.A.C.K. (gaming app construction kit) > Feedback

IF command bug

(1/1)

Jonás Perusquía:
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:

--- Code: (glbasic) ---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
--- End code ---


--- Code: (glbasic) ---*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:71fa70a5 - 3D, NET
"TEST2.gbas"(77) error : IF without ENDIF / THEN
--- End code ---

i though it was my fault, but now i think this is a bug of GLBasic..

¿What do you think?

Moru:
Code runs fine for me, check higher up in your program so all loops, functions and if/else are terminated.

Slydog:
Ya, your problem is most likely above this code.

Also, this line:

--- Code: (glbasic) ---IF my-10 > y3-1 AND my+71 > y3+60
--- End code ---
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?:

--- Code: (glbasic) ---IF my > y3-1+10 AND my > y3+60-71
--- End code ---

[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):

--- Code: (glbasic) ---IF player_y > floor_y-1 + floor_thickness AND player_y > floor_y + player_height - jump_height
--- End code ---

Jonás Perusquía:
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!

Moru:
We were right because the same has happened to all of us :-)

Navigation

[0] Message Index

Go to full version