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 / When I clone a sprite , will the memory allocation increase?

Author
Message
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 2nd Dec 2011 14:56
I want to clone 100 sprites, but I afraid memory increases rapidly.

The Miracrea Games
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Dec 2011 15:23
Cloning a sprite is the same as creating a new one, it just saves you having to copy the parameters. Sprites themselves don't use that much memory, the images assigned to them use far more so as long as they share images (and don't each load their own copy of the image) it should be fine.
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 2nd Dec 2011 15:46
I see.Thank you, Paul.

The Miracrea Games
Deion
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 2nd Dec 2011 16:37
hmm never looked into it, but do you mean a clone points to the same memory as the original for the image handle? just a popped up question reading your response..

Cheers,
Deion G.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Dec 2011 23:15
Yes, when cloning the image handle is copied and not the image.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 3rd Dec 2011 00:06
It's like:



That would create 100 sprites using a single image.

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 3rd Dec 2011 02:42
Thanks. I think Paul had given me the exact answer what I need.

The Miracrea Games

Login to post a reply

Server time is: 2024-11-22 14:59:02
Your offset time is: 2024-11-22 14:59:02