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 Studio Chat / Useful idea (I think)

Author
Message
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 14th Nov 2019 20:47
Hi guys !!

I will find it useful to have a sprite delete option in the playsprite function.
If for example, the sprite is played only once, it is deleted by itself once the animation is over !
It would be really great !

would it be possible to add that in some way ?

I do what i do !!!
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 14th Nov 2019 21:47
DeleteSprite() <--- Delete the sprite yourself. The last thing you want is your compiler or interpreter assuming you want resources deleted.
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 14th Nov 2019 22:05
Wow !!! We can use deletesprite ????? ^^ How does it work??? :p

I really think it could be useful!
That or an command that allows to limit the life time of the sprite !






I do what i do !!!
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 14th Nov 2019 22:09
I'm not sure I'd recommend it, but you could code that yourself with a couple of functions like this (roughly):

Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 15th Nov 2019 19:04
Thank you Hendron,
I already have little loops for that, the idea was to aim to have no more to do ...
I do what i do !!!
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 16th Nov 2019 18:21
Not exactly a built in "delete sprite when animation finished", I would prefer a GetAnimationEnd function, yes you can code this for yourself with interpreted code but a built in callback in C++ (like the ones for almost everything else in AGK) would be much faster.

Like:



Also a GetAnimationCount function.....

Just a thought
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 17th Nov 2019 06:37
OK, thanks

I thought the agk developers will add a function that will not check each sprite!
it will save coding time and machine time too: p
I do what i do !!!
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 17th Nov 2019 10:30 Edited at: 17th Nov 2019 10:31
if GetSpritePlaying()=0 tells you if an animation has finished playing, you can then decide to reuse the sprite (for explosions etc...) or you can delete it yourself.

It takes 1 line of code! ..just delete it yourself if you want to.

Login to post a reply

Server time is: 2024-03-28 10:12:17
Your offset time is: 2024-03-28 10:12:17