I'll add more ship parts once I get the ship moving around the map. It shouldn't be too hard.
You'll be able to make the ship as big or small as you want so long you have the parts!
I'm gonna have to figure out how to render these mofo's though... Gonna be a pain when I try to rotate the ship.
EDIT: figured it out. You have 2 for loops. each going the length of the of the array that holds the individual blocks. That part wasn't hard. The hard part was figuring out the offsets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(int i = 0; i < sMap.map.ship2.blocks.length;i++) | |
for(int j = 0; j <sMap.map.ship2.blocks[i].length; j++){ | |
// this convoluted mess offsets the ship so it renders all the squares in the right spots.. | |
batch.draw( | |
// the texture that I'm using | |
sMap.map.ship2.blocks[i][j].tr1, | |
// the x location of the ship I'm using | |
sMap.map.ship.center.x + j *(size)- (float)sMap.map.ship2.blocks.length / 2*size, | |
// the y location of the ship I'm using | |
sMap.map.ship.center.y-i*(size)+(((float) sMap.map.ship2.blocks.length/2)-1) *size, | |
// the x offset | |
(float)size*sMap.map.ship2.blocks.length/2-size*j, | |
// the y offset | |
size/2 +size*i -size*2, | |
// the width of the textures in pixels | |
size, | |
// the heigth of the texture in pixels | |
size, | |
// the x scale | |
1f, | |
// the y scale | |
1f, | |
// the rotation of the ship, the dirction it is pointing. | |
sMap.map.ship.getDirection()-90 ); | |
} |
No comments:
Post a Comment