Expecting 'EndIf'?!
Blitz3D Forums/Blitz3D Beginners Area/Expecting 'EndIf'?!
| ||
I was going through the collision tutorial that came with blitz, and I came across a error doing it myself. Everytime I try to run the code I get the error 'Expecting EndIf'. I don't know why it's doin it, hopefully someone here can help. Here is my code: Graphics3D 800, 600 Const col_sphere = 1 Const col_cube = 2 SetBuffer BackBuffer() camera = CreateCamera() PositionEntity camera, 0, 0, -5 light = CreateLight() sphere = CreateSphere(12) PositionEntity sphere, -5, 0, 5 EntityType sphere, col_sphere cube = CreateCube() PositionEntity cube, 5, 0, 5 EntityType cube, col_cube Collisions col_sphere, col_cube, 3, 1 While Not KeyHit(1) MoveEntity sphere, .1, 0, 0 RenderWorld UpdateWorld If EntityCollided (sphere, col_cube) Then Text, 300, 300, "Collided!" EndIf Flip Wend End Thanks in advance for help |
| ||
Should be "End If" - not "EndIf" |
| ||
I still get the same error after replacing EndIf with End If. |
| ||
No comma after TextText 300, 300, "Collided!" |
| ||
It's always the little things ;) Thanks for the help guys. |
| ||
"EndIf" is fine - I use it all the time. :) |
| ||
For future reference, when this sort of error happens, run with the debugger and/or pay attention to which line the cursor is moved to (the cursor will be moved to the problematic line.) |
| ||
If you cannot see where the cursor is - Hold down the [control] key and press the [end] key and the line will be highlighted. Thanx to the chap that told me about that. |
| ||
Yah, that "End if" error comes up for more things than just the If...Endif commands. Another thing that can trigger it is not having a "WEND" to your "WHILE". @Graythe: I didn't know that! Thanks for that really useful tip! |