• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM sprite_add vs sprite_create_from_surface

B

Big_Macca_101

Guest
Hi there guys, a little bit of a noobish question but im looking to speed up my games sprite importing by using external sprite strips but as far as im aware using sprite_add will actually create a separate texture page per sprite loaded, so i'm just curious as to whether or not using a larger sprite sheet would be more effective and memory efficient than separate sprite strips because i haven't heard all to much about the sprite_create_from_surface function, cheers and I do apologise if i worded this horribly!
 
sprite_create_from_surface is going to give you the same problem. You'll create a surface (that gets its own texture page) and then create a sprite from that surface (which, again, will be put on its own texture page). As far as I know, your best bet would be to load in a giant texture page as a big sprite, and then use draw_sprite_part to only draw specific sprites from that texture page. Which sounds like WAY more work than it's worth.
 
B

Big_Macca_101

Guest
sprite_create_from_surface is going to give you the same problem. You'll create a surface (that gets its own texture page) and then create a sprite from that surface (which, again, will be put on its own texture page). As far as I know, your best bet would be to load in a giant texture page as a big sprite, and then use draw_sprite_part to only draw specific sprites from that texture page. Which sounds like WAY more work than it's worth.
Damn! Thanks for the help, back to the drawing board I guess!
 
N

Never Mind

Guest
You can also consider how sprite_replace() may possibly help.

For instance take Pixelated_Pope's idea to use draw_sprite_part() from one big externally-loaded sprite sheet.
..Instead of throwing all sprites into one image, you could separate them out into different parts of the game.

So if you don't need them all loaded into memory all the time..
you could figure out what parts of the game need which sprites, and sprite_replace() with the right sheets.

An example would be an adventure game with world themes (Mario, Zelda, etc.)
The first world might be a water world, so you load the water themed sheet.
The next might be a lava world, so you load the lava themed sheet.

I know I'm not pointing out anything new really, but I like the idea of this sort of thing being an option for me if I ever need it.

-P.S I'm back baby! :cool: first post on the new forum!!!
 
Top