"Expecting Wend"
BlitzMax Forums/BlitzMax Beginners Area/"Expecting Wend"
| ||
I made a small game from the blitz3d manual as a source, and something weird happened. After I finished up the game, I tried to play it and it said "Expecting Wend". I then added wend and it still said the same message. Here's the game. It's small, so it isn't to complicated. Dim skyline(40) For i=0 To 39 skyline(i)=Rnd(18,28) Next If bomb_y bomb_y=bomb_y+1 Else If KeyDown( 57 ) bomb_x=plane_x bomb_y=bomb_y+1 EndIf ;check bomb If bomb_y If bomb_y>=29 bomb_y=0 Else If bomb_y>skyline(bomb_x) ;BOOM1 bomb hits skyline! score=score+5 skyline(bomb_x)=skyline(bomb_x)+30 If skyline(bomb_x)>=29 skyline(bomb_x)=29 score=score+15 EndIf bomb_y=0 EndIf EndIf Graphics 640,480 SetBuffer BackBuffer() Dim skyline(40) For i=0 To 39 skyline(i)=Rnd(18,28) Next plane_x=0 plane_y=1 bomb_x=0 bomb_y=0 While Not KeyHit( 1 ) Delay 75 Cls ;move player plane_x=plane_x+1 If plane_x=40 plane_x=0 plane_y=plane_y+1 EndIf ;move bomb If bomb_y bomb_y=bomb_y+1 Else If KeyDown( 57 ) bomb_x=plane_x bomb_y=plane_y+1 EndIf ;check bomb If bomb_y If bomb_y>=29 bomb_y=0 Else If bomb_y>=skyline(bomb_x) ;boom bomb hits skyline! score=score+5 skyline(bomb_x)=skyline(bomb_x)+30 If skyline(bomb_x)>=29 skyline(bomb_x)=29 score=score+15 EndIf bomb_y=0 EndIf EndIf ;draw runway Color 0,25,0 Rect 0,480-1,640,16 ;draw skyline Color 255,255,0 fir i=0 To 39 Rect i*16,plane_y*16.16.16 EndIf ;draw score Color 255,255,255 Text 0,0,"Score="+score Flip False ;check player If plane_x=20 And plane_y=28 RuntimeError "You Win!" If plane_y>=skyline(plane_x) RuntimeError "you Lose!" Wend Is there a reason why it won't work, or is it a bug? |
| ||
Wrong sub-forum! |
| ||
oh. well where should it go? |
| ||
oops, I'm in the blitzmax sub forum. my bad. |
| ||
Blitzmax code: I still dont understand the game - LOL ;) |
| ||
to resolve your original code: well for one: towards the end you have: ;draw skyline Color 255,255,0 fir i=0 To 39 Rect i*16,plane_y*16.16.16 EndIf change this to: ;draw skyline Color 255,255,0 for i=0 To 39 Rect i*16,plane_y*16.16.16 next you are using a for-next command here. it was expecting a 'wend' to close off the 'while' command you started towards the beginning, but you put in an 'endif' and since there is no previous 'if' command it thought you were using the 'endif' command to close of the 'while' command. that should explain your error and fix some other errors you had. however i still dont quite get the game. :P and the fellow above me has re-written it for you, but with no explanation that wont be as much a help to you as a hindrance. good luck anyways. Cheers! B |
| ||
and the fellow above me has re-written it for you, but with no explanation that wont be as much a help to you as a hindrance. I didnt bother explaining the issues as they have already been pointed out in his other thread: http://www.blitzbasic.com/Community/posts.php?topic=89053#1010926 I just rewrote it in BlitzMax to see what the game was ;) |
| ||
Yo, noob... best advice I can give is to indent your code, for 2 reasons: 1. It's a lot easier for you to read and debug. 2. There are quite a few people who won't bother helping you out unless the code is easily readable. Happy blitzing. |
| ||
@therevills Understood didnt mean to bash you, sorry. ran your code. what a delightful game! you dont have to actually do anything and your score goes up! :P @noob John Gait has a HUGE point! indent to keep track of everything like your while-wends and your if-endifs and such. also instead of writing this: score=score+5 you can write this: score:+5 hope that helps |
| ||
Why are people posting here when a post has already been made in the right forum, and he isn't using BlitzMax so some of this advice isn't even helpful.. |
| ||
I don't check all the forums to see if there's another post on the same subject. |