Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Counting sprites

Author
Message
Old Wrinkly
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Nth Devon UK
Posted: 17th Dec 2003 16:41
I have a number of sprites on the screen which are moving,colliding and iether being hidden or deleted after a collision
I wish to know how many sprites are left at any given time, iether by sprite number or image number.
In plain language "when there are only "total" left, then end"
Thank You. Gemini
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Dec 2003 17:20
Well if you know how many you start off with just use...

SpriteNo = Number of sprites

If sprite collision........
Dec SpriteNo
Endif

If SpriteNo = minimum then go where your program ends.

Pincho.
Old Wrinkly
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Nth Devon UK
Posted: 17th Dec 2003 17:58
thanks Pincho, I did try that previously,but whenever there was a collision, the number decreased by more than 1 before the sprite was deleted, so in no time atall it had come to the end of the count while most of the sprites where still there.
Is there a way of stopping the collision detection on the sprite, once the first one has registered ?.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Dec 2003 18:12
Sprite Hit() works like that! It just works once.

Pincho.
Old Wrinkly
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Nth Devon UK
Posted: 17th Dec 2003 18:21
Thanks Pincho Will do.
Been programming since pre-Amos days, but still come accross these silly little snags (Must be my age) Old Wrinkly.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Dec 2003 18:43
If you use the original editor and not DarkEdit then it's easier to learn. Just type sprite hit and press F1.

Pincho.

Login to post a reply

Server time is: 2024-05-11 14:49:32
Your offset time is: 2024-05-11 14:49:32