Game Design Music and Art

whats wrong – gaurdianAQ

gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
does anybody see anything wrong with this while wend loop it used to work but now it keeps saying wend with out while???
[code]While playerbullet\bullet = 1
Cls
testinput() enemies()
playerbullet\move = 1
playerbullet\bullet = 1
If playerbullet\bullet = 1 Then
Text player\x, player\y, player\tankstring$;prints the tank on the screen
Text playerbullet\x, playerbullet\y, playerbullet\bulletstring$;prints the bullet
playerbullet\y = playerbullet\y - 3
If playerbullet\y <= 0 Then;determines whether the bullet goes off the screen
;sets the bullet back to the starting position
playerbullet\y = player\y;;;;;;;;;;;;;;;;;;;;;
playerbullet\x = player\x + 16;;;;;;;;;;;;;;;;
playerbullet\bullet = 0;determines whether the bullet has been shot
playerbullet\move = 0;determines whether to move the bullet with the tank
EndIf
Flip
Wend
sorry if this does not appear right it would not copy and paste correctly but I see nothing wrong with this loop does anyone here I am using B3D
Lava
Member

Posts: 1905
From:
Registered: 01-26-2005
It might not be the while loop exactly, sometimes Blitz says that when like say you leave a EndIf out of a If statement, make sure all of your For statements, Functions, While loops and If statements are all ended properly

------------------

gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
but it points this one out and this one used to work yesterday it just stopped working today but I will check
Lava
Member

Posts: 1905
From:
Registered: 01-26-2005
Where's the EndIf in this one?


If playerbullet\bullet = 1 Then
Text player\x, player\y, player\tankstring$;prints the tank on the screen
Text playerbullet\x, playerbullet\y, playerbullet\bulletstring$;prints the bullet
playerbullet\y = playerbullet\y - 3

It looks like it's just the next If statement afterwards.

It needs to be like this:


While playerbullet\bullet = 1
Cls
testinput() enemies()
playerbullet\move = 1
playerbullet\bullet = 1
If playerbullet\bullet = 1 Then
Text player\x, player\y, player\tankstring$;prints the tank on the screen
Text playerbullet\x, playerbullet\y, playerbullet\bulletstring$;prints the bullet
playerbullet\y = playerbullet\y - 3
EndIf
If playerbullet\y <= 0 Then;determines whether the bullet goes off the screen
;sets the bullet back to the starting position
playerbullet\y = player\y;;;;;;;;;;;;;;;;;;;;;
playerbullet\x = player\x + 16;;;;;;;;;;;;;;;;
playerbullet\bullet = 0;determines whether the bullet has been shot
playerbullet\move = 0;determines whether to move the bullet with the tank
EndIf
Flip
Wend

Or (if you want an If statement in an If statement, like say you want the 2nd one to only happen IF the other one happens)


While playerbullet\bullet = 1
Cls
testinput() enemies()
playerbullet\move = 1
playerbullet\bullet = 1
If playerbullet\bullet = 1 Then
Text player\x, player\y, player\tankstring$;prints the tank on the screen
Text playerbullet\x, playerbullet\y, playerbullet\bulletstring$;prints the bullet
playerbullet\y = playerbullet\y - 3
If playerbullet\y <= 0 Then;determines whether the bullet goes off the screen
;sets the bullet back to the starting position
playerbullet\y = player\y;;;;;;;;;;;;;;;;;;;;;
playerbullet\x = player\x + 16;;;;;;;;;;;;;;;;
playerbullet\bullet = 0;determines whether the bullet has been shot
playerbullet\move = 0;determines whether to move the bullet with the tank
EndIf
EndIf
Flip
Wend

------------------

[This message has been edited by LAVA (edited January 20, 2007).]

gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
I just figured that out thanks though
Lava
Member

Posts: 1905
From:
Registered: 01-26-2005
Awesome

Did it fix your problem?

------------------

gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
ya but I have just run into other problems lol