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 / AUTO Delete Sprite after last frame of animation

Author
Message
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 24th Feb 2012 08:33
Hi all, just thought I would ask if anyone knows whether it is possible to auto delete a sprite when the last frame of animation has occurred?

The PlaySprite animation would have to be 'non-looping' and when the last frame had played the sprite is deleted..

I guess this would require a parameter in the PlaySprite command i.e. PlaySprite(spriteID,20,0,1,10,1) where the last digit, a 1 in this case indicates Delete Sprite or 0 do not delete.

This would be a massive benefit, preventing the need to check for when a sprite has finished animating before deleting.. such as in a explosion. With a small number of sprites you can run through a loop checking your 'playing' sprites to test for last frame, but with a large number of sprites it becomes a heavy overhead...


Any Ideas? If not possible, is this worth suggesting?

Rudders
Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 24th Feb 2012 08:57
Rudders again, it just occured to me that it would be better to have the 'animation loop' parameter (third parameter) able to set as follows:

0 = Play Once
1 = Loop
2 = Delete after last frame

This would keep the command compatible with existing code.

Just an idea?

Rudders
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 24th Feb 2012 12:15
You can do it this way:

(Put this into the main loop)



This will a) check if the sprite exists.
b) Check if current sprite frame is equal to the last frame.
c) Delete it if both conditions match.

That's it!

Rudders
12
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 24th Feb 2012 20:09
Thanks for the reply, I already use this but with hundreds of sprites to test a For / Next loop is required to check each one. this is slow and therefore my question about an 'Auto Delete' option.

Where do we submit 'Suggestions' for future developemnt, does anyone know?

Rudders
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 14:49
Quote: "Where do we submit 'Suggestions' for future developemnt, does anyone know?"


I believe the Google Code-base... but I am unfamiliar with the link address for it sorry

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 15:06
http://code.google.com/p/agk/issues/list

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 15:10
baxslash to the rescue!

only...

http://code.google.com/p/agk/issues/list

fixed no?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 15:16
Didn't make it a link... sorry for being lazy

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 15:18
Quote: "Didn't make it a link... sorry for being lazy"


Now get down and give me 20 pushups

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 15:20
Sir yes Sir!
1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... 17... 18... 19... 20

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 15:28
drat!


bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 27th Feb 2012 16:30
Might I recommend running the check only 10 times each second. You might see a dramatic pick up in speed with no visual change

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 27th Feb 2012 16:36
Quote: "Might I recommend running the check only 10 times each second. You might see a dramatic pick up in speed with no visual change"


ahhh perhaps a form of stacking?

Login to post a reply

Server time is: 2024-05-02 02:44:58
Your offset time is: 2024-05-02 02:44:58