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.

Newcomers AppGameKit Corner / Can An Image Be Deleated After Loading A Sprite?

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 24th Oct 2019 23:58
Hi,

Wondering if:
I can delete an image after I used it to create a sprite?
Let me know, thanks!

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 25th Oct 2019 04:48

it takes just ask long to test it yourself as it does to pose the question?


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 25th Oct 2019 11:58
Write a small app that creates a sprite from an image, deletes the image and then manipulates or redisplays the sprite. That will give you your answer.
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 25th Oct 2019 15:30 Edited at: 25th Oct 2019 16:00
Tried it, does not work...

- Loaded an image
- loaded a sprite from loaded image
- deleted image
(sprite is white now?)

Jesse
JeZxLee
Fallen Angel Software
Video Game Design Studio
http://www.FallenAngelSoftware.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Oct 2019 19:03 Edited at: 25th Oct 2019 19:39
if you are going to use an image you cant just delete it

if you delete the sprites/objects that use the image you can then delete the image
otherwise you will get crashes

The idea of deleteimage is to delete an image you are finished using

I think what you want is https://www.appgamekit.com/documentation/Reference/Sprite/DeleteSprite.htm


fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 25th Oct 2019 20:33 Edited at: 25th Oct 2019 20:36
also:
Quote: "Can An Image Be Deleated After Loading A Sprite?"
(sic) which suggested that you were using LoadSprite()

while:
Quote: "GetSpriteImageID
Gets the ID of the image currently assigned to the sprite. This only works if the image was loaded with an ID (or assigned one by AGK)"

...which doesn't appear to be the case (ID = 0 using LoadSprite() = nothing to delete).

then:
Quote: "Tried it, does not work..."

...but, didn't use LoadSprite().

hoping all of this helps

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 1st Jan 2020 20:17
The exception... I think... is that you can delete sub images so long as you dont delete the main atlas image.
Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)

Login to post a reply

Server time is: 2024-11-23 09:30:18
Your offset time is: 2024-11-23 09:30:18