expecting end-of-file
Archives Forums/Blitz3D Bug Reports/expecting end-of-file
| ||
I am getting this error at what seem to be random places in my program, and cannot fix it I figured out these places by erasing things or copying and pasting the program, into a different tab, and every time it wound up in a different place. It is marked by (HERE) code example: Graphics 340,260,34,2 SeedRnd MilliSecs() plx=170 ply=130 pldir$="up" playerup=LoadAnimImage("game\player.bmp") playerright=RotateImage playerup(HERE),90 playerdown=RotateImage playerright,90 playerleft=RotateImage playerdown,90 While Not KeyDown(1) DrawImage player,plx,ply If pldir$="up" Then ply=ply-6 ElseIf pldir$="right" Then plx=plx+6 ElseIf pldir$="down" Then ply=ply+6 EndIf Delay 60 Flip Wend(HERE) (HERE) END CODE EXAMPLE. |
| ||
Normally the expecting end of file error happens due to exotic syntax errors, like corrupt DATA stuff and things. Maybe there is a problem with your ELseif construct. I never use ElseIf, so I'm not sure about it, but you should try to simplyfy it: If pldir$="up" Then ply=ply-6 endif If pldir$="right" Then plx=plx+6 endif If pldir$="down" Then ply=ply+6 EndIf And I also think you don't need to retrieve a return value from RotateImage. |
| ||
RotateImage rotates the actual image, it does not create a rotated duplicate. You need: playerright=CopyImage(playerup) RotateImage playerright,90 playerdown=CopyImage(playerup) RotateImage playerdown,180 playerleft=CopyImage(playerup) RotateImage playerleft,270 While Not KeyHit(1) Cls If pldir$="up" DrawImage playerup,plx,ply,frame ply=ply-6 ElseIf pldir$="right" DrawImage playerright,plx,ply,frame plx=plx+6 ElseIf pldir$="down" DrawImage playerdown,plx,ply,frame ply=ply+6 Else DrawImage playerleft,plx,ply,frame plx=plx-6 EndIf Delay 60 Flip Wend End For obvious reasons, the code above does not actually run (there are a few things that are not in there because they have no bearing on the issue, but that are essential for proper program flow) |