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 DBPro Corner / need data for animated sprite?

Author
Message
michael_one
13
Years of Service
User Offline
Joined: 24th Dec 2010
Location:
Posted: 7th Mar 2012 07:36
In "CREATE ANIMATED SPRITE 1,"ogreattack.bmp",13,8,5".

1 = The sprite number you want to create
13 = The number of frames across
8 = The number of frames down
5 = The image number you want that sprite to use

what is the easiest way to find out these numbers for each new animated sprite?

Attachments

Login to view attachments
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 8th Mar 2012 21:41
I use a for loop to iterate through the integers for the next available sprite number and next available image number.
Then I create the sprite, make sure it exists and move on.
If you're looking for an automated way to find the frames, I don't think that is possible.

I make an array that stores the number of frames in each image using the image number as an index (which I use a named constant for).
Also I try very hard to make the image number and the sprite number the same since I really like to use named constants.
For example:



The other, more likely cleaner method would be to use UDTs to store x_frames, y_frames, ogre_sprite, and ogre_image.
Something like this:



The you may go as far as to use the READ BYTE/FILE/FLOAT/etc commands to load the data in systematically from a
data file.
Hope all of this helps, I kind of got carried away trying to think out how I'm doing it in my current project.

michael_one
13
Years of Service
User Offline
Joined: 24th Dec 2010
Location:
Posted: 31st Mar 2012 10:41
thanks heaps for the knowledge ill put that to good use. cheers!
michael_one
13
Years of Service
User Offline
Joined: 24th Dec 2010
Location:
Posted: 31st Mar 2012 10:41
thanks heaps for the knowledge ill put that to good use. cheers!

Login to post a reply

Server time is: 2024-11-23 20:58:51
Your offset time is: 2024-11-23 20:58:51