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.

AppGameKit Classic Chat / Deleting animated sprites.

Author
Message
Josk
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 29th Aug 2011 23:44
I'm still getting to grips with AppGameKit and types etc and I have got stuck with deleting a sprite if the animation has finished.
The following functions are called in the main program loop.
The problem is only the latest explosion gets deleted, So if theres more than one explosion happening the earlier ones stop on the last frame and stop on screen.
Any help would be appreciated.
Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 29th Aug 2011 23:54
Rewrite your update code as follows:

You need to check your variables against your loop counter, not the value of "debris" as it currently stands.

You also need to start your loop from 1, as that's what you're resetting "debris" to when it becomes larger than 10.
Josk
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 30th Aug 2011 00:19
Thanks for the code, understand that bit now.
It actually turned out that debris wasn't set as global.
I thought when you set a variable outside a function it is Global by default.

Login to post a reply

Server time is: 2024-05-06 13:34:10
Your offset time is: 2024-05-06 13:34:10