forums

TNT Basic Forums > Programming Q&A
sprite col and sprite off
< Last Thread     Next Thread >
Author
Thread        Post A Reply

03-12-2003 07:11

Posted by:
Martin Samuels

Click Here to Email Martin Samuels   Find more posts by Martin Samuels

I have a galaxian type game with a formation of
enemies at the top of the screen. My problem is
that when I shoot the enemies they are removed
from the formation but they stay on the screen and
do not move.

sprite 16 is the player's bullet

for a=1 to alien_no
if sprite col (16,a)<>-1
sprite off a
sprite off 16
alien_no=alien_no-1
end if
next

Thank You

03-13-2003 10:58

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

First your're declaring 'a' as a variable and then again as a sprite ID without re-declaring this in your sample code. TNT thinks your applying the 'sprite off' command to a integer. Could this be why?

03-16-2003 20:55

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

First your're declaring 'a' as a variable and then again as a sprite ID without re-declaring this in your sample code. TNT thinks your applying the 'sprite off' command to a integer. Could this be why?

No, Martin's correct. A sprite is identified by a number, and integers store numbers so he's ok there.

Martin, your code looks fine, the only problem I can think of is that your game accidentally puts the sprite back on screen using the 'sprite' command after it's been removed? Once a sprite has been put on screen it will stay there until it is removed, so you need only be accidentally putting the sprite on screen once more after it's removed and it will stay there forever.

Hope this helps, if not post your code.

Cheers,

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.