Skip to main content
gamedev.net
🔒 Locked

Multidimensional Array problem

Started by SGEO Jan 14, 2001 at 6:33 AM 1 replies 400+ views
Original Post
SGEO
SGEO
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}
		}
			
	};
  
Indy
Indy
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
Indy
SGEO
SGEO
Dont worry problem solved. My syntax was right, I just didnt define my constants properly. Stupid errors, like most.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.