Jump to content
  • Advertisement

Archived

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

SGEO

Multidimensional Array problem

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im pretty new to using multidimensional arrays larger than 2Ds. Im using a 3D one a look up table for getting the stats of enemy ships in the 2D shooter Im making. ive worked out how to initialise and declare it based on how it is done with 1D and 2D arrays, but I must be missing something because I keep getting syntax compiler errors when trying compile the following code.
  
	static int tableEnemyShip[NUM_ENEMY_CLASS][NUM_ENEMY_SHIPS_IN_CLASS][NUM_ENEMY_DATA] = { 
			//==========PRESET AI ROUTINE CLASS OF SHIPS=======================//

		{
			//cruiser Type

			{AI_DOWN,ENEMY_CR_HLTH,ENEMY_CR_HLTH,ENEMY_CR_DX,ENEMY_CR_DY,NUM_CRUISERS,
				ENEMY_CR_FRAMES,ENEMY_CR_HEIGHT,ENEMY_CR_WIDTH,ENEMY_CR_GRID}


		},//end set AI routine class

			
		//=============PRESET DIR CLASS OF SHIPS================================

		{
			//ship 1

			{ENEMY_SD1_DX_MOD,ENEMY_SD1_HLTH,ENEMY_SD1_HLTH,ENEMY_SD1_DX,ENEMY_SD1_DY,ENEMY_SD1_NUM,
				ENEMY_SD1_FRAMES,ENEMY_SD1_HEIGHT,ENEMY_SD1_WIDTH,ENEMY_SD1_GRID}
		}
			
	};
  

Share this post


Link to post
Share on other sites
Advertisement
Why don''t you use an array of structures to do what your trying to do? Thats what I used for my 2d Shootem-up, it was very simple.

If you want to see an example from my code let me know your email address, i will mail you the relavant code.

Indy

Share this post


Link to post
Share on other sites
Dont worry problem solved. My syntax was right, I just didnt define my constants properly. Stupid errors, like most.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!