• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

This topic is 6577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have read Tricks of the Windows Game Programming Gurus and Windows Game Programming for Dummies. I understand most of the things in these books except working with animation. I was modifying the Underworld (a 2d, top down view demo game) and wanted to add a walk north and walk south animation in addition to the walk east and west animations. This is where I am stuck. In the books it says to define animations you do this... int anim walk[] = {0,1,2,1,0}; But the game does this... // animations for poos: bounce, crush, burrow int poo_anims[5][4] = { {0,1,-1,-1}, {2,3,-1,-1}, {4,5,-1,-1}, {6,7,-1,-1}, {8,9,10,9} }; Can anyone please tell me 1. What the numbers between the brackets mean. 2. Why there are negative numbers between the braces. Thank you.

##### Share on other sites
I haven''t read the book so I don''t know exactly what it''s trying to do.

Basically it''s declaring a two dimensional array, the extra brackets seperate the dimensions

The first set of numbers, {0,1,-1,-1} go into elements poo[0][0], poo[0][1], poo[0][2] and poo[0][3] respectively

The second set of numbers, {2,3,-1,-1} goes into poo[1][0], poo[1][1] ....

and the last set, {8,9,10,9} into poo[4][0], ..... poo[4][3]

The -1''s are probably a code to the program to tell it that no more frames exist, i.e. the first set {0,1,-1,-1} has only two frames, 0 and 1.

HTH

##### Share on other sites
Thanks for the help but I still don''t really understand. I know he is defining bitmaps for animation using the EXTRACT_MODE_CELL but I still wonder about the -1 because it was not used in the first example. Has anyone used the GPDUMB engine in their games?

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634047
• Total Posts
3015226
×