Switching form TGA to DDS seemed to have helped a little. Any specific mode I should use? (DXT1? DXT5?). I'll look into using images for non-colliding tiles.
I don't know what you mean by splitting up the movement... don't I need them all to move at the same time in the same loop so it looks right?
I also tried hiding sprites that are off screen, then showing them when they get back in view, but that didn't seem to do much.
Here's the function I use to move a "map" (each map is assigned to a cell on a sort of imaginary grid, example: map 0,0 is in the very bottom left corner and map 1,0 is to the right of that one, each map is 16x16 tiles, tiles are 32x32 pixels). Moving just 3 maps together is very sluggish, I would like to be able to do more than 3 without a FPS hit.
void move_map(int mMapcellx, int mMapcelly, int direction){
for (int x=0; x<16; x++){
for (int y=0; y<16; y++){
int dbS = map[mMapcellx][mMapcelly].tileSN[x][y];
dbSprite(dbS,dbSpriteX(dbS)+direction,dbSpriteY(dbS),dbSpriteImage(dbS));
}
}
}
This code is used to call the move map code and makes a screen scrolling effect (sprite #1 is the player). It's a lot like 8-bit Mega Man games if you've ever played those. The pright and pleft values are used to check if the "camera" should stop moving in that direction.
if (right == true){
if (map[cellx][celly].pright==false){
if (dbSpriteX(1)+16 > 256){
if (dbRightKey()){
dbSprite(1,dbSpriteX(1)-2,dbSpriteY(1),1);
move_map(cellx,celly,-2);
for (int ii=1; ii<20; ii++){
if (cellx+ii <=100){
if (map[cellx+ii-1][celly].pright == false){
move_map(cellx+ii,celly,-2);
}
}
if (cellx-ii >=0){
if (map[cellx-ii+1][celly].pleft == false){
move_map(cellx-ii,celly,-2);
}
}
}
}
}
}
}
if (left==true){
if (map[cellx][celly].pleft==false){
if (dbSpriteX(1)+16 < 256){
if (dbLeftKey()){
dbSprite(1,dbSpriteX(1)+2,dbSpriteY(1),1);
move_map(cellx,celly,+2);
for (int ii=1; ii<20; ii++){
if (cellx+ii <=100){
if (map[cellx+ii-1][celly].pright == false){
move_map(cellx+ii,celly,+2);
}
}
if (cellx-ii >=0){
if (map[cellx-ii+1][celly].pleft == false){
move_map(cellx-ii,celly,+2);
}
}
}
}
}
}
}
if (right==true){
if (map[cellx][celly].pright==true){
if (dbSpriteX(map[cellx][celly].tileSN[15][0])+32 > 512){
if (dbRightKey()){
dbSprite(1,dbSpriteX(1)-2,dbSpriteY(1),1);
move_map(cellx,celly,-2);
for (int ii=1; ii<20; ii++){
if (cellx+ii <=100){
if (map[cellx+ii-1][celly].pright == false){
move_map(cellx+ii,celly,-2);
}
}
if (cellx-ii >=0){
if (map[cellx-ii+1][celly].pleft == false){
move_map(cellx-ii,celly,-2);
}
}
}
}
}
}
}
if (left == true){
if (map[cellx][celly].pleft==true){
if (dbSpriteX(map[cellx][celly].tileSN[0][0]) < 0){
if (dbLeftKey()){
dbSprite(1,dbSpriteX(1)+2,dbSpriteY(1),1);
move_map(cellx,celly,+2);
for (int ii=1; ii<20; ii++){
if (cellx+ii <=100){
if (map[cellx+ii-1][celly].pright == false){
move_map(cellx+ii,celly,+2);
}
}
if (cellx-ii >=0){
if (map[cellx-ii+1][celly].pleft == false){
move_map(cellx-ii,celly,+2);
}
}
}
}
}
}
}