#83010 - Lini - Fri May 12, 2006 12:27 am
I can't seem to figure this out myself.
I have 2 arrays for ship placement, one for horizontal and one for vertical:
I use ham_CreateObj() to create the ships at the correct x/y position:
I also update the ship graphic according to ships_type (which is the ship type).
Yes, I know I could use a 'for' loop, I just forgot about i when I coded this. It was about 2AM, and I was tired.
But when I get more than 6 ships in collection, it causes the graphics to bug out, and it crashes when you try to go to flight-mode after that.
Other related code:
The interface background (I'm using a 256 color bitmap, had to convert to gif to upload/show):
[Images not permitted - Click here to view it]
I have 2 arrays for ship placement, one for horizontal and one for vertical:
Code: |
const u8 IN_ROW[21] = {0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2}; //The row each ship is in const u8 IN_COL[21] = {0,1,2,3,4,5,6,0,1,2,3,4,5,6,0,1,2,3,4,5,6}; //The column each ship is in |
I use ham_CreateObj() to create the ships at the correct x/y position:
Code: |
while(i < MAX_IN_COLLECTION) { if(ships_type[i] != NO_SHIP) { ships[i] = ham_CreateObj((void*)&shipspr_Bitmap, OBJ_SIZE_16X16,OBJ_MODE_NORMAL,1,0,0,0,0,0,0,((IN_COL[i])*19)+4,((IN_ROW[i])*19)+103); ham_UpdateObjGfx(ships[i],(void*)&shipspr_Bitmap[256*ships_type[i]]); } i++; } |
I also update the ship graphic according to ships_type (which is the ship type).
Yes, I know I could use a 'for' loop, I just forgot about i when I coded this. It was about 2AM, and I was tired.
But when I get more than 6 ships in collection, it causes the graphics to bug out, and it crashes when you try to go to flight-mode after that.
Other related code:
Code: |
#define NO_SHIP 150 const u8 MAX_IN_COLLECTION = 21; |
The interface background (I'm using a 256 color bitmap, had to convert to gif to upload/show):
[Images not permitted - Click here to view it]