okay so im having a program. im trying to do a basic tactical rpg (solid color tiles green=grass ect. circles=allys squares=bad guys) anyways i decided to work on rendering that map first. so my resolution is 640x480, and im using 25x15, 32x32 tiles. if thats not too confusing. Now i made a text file that holds all the frame data for the tileset:
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
4 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4
4 2 2 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4
4 2 2 2 2 1 1 1 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 4
4 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 4
4 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4
4 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4
4 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4
4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 4
4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 4
4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 4
4 2 2 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 4
4 2 2 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 4
4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
And so begins my first problem. sometimes it pulls a garbage value out of there (source code below) of 53, or 64 its seeminly random i dont understand. Heres the source code im using.
"map.h"
class map
{
public:
map();
~map();
int control();
private:
int data[25][15];
int draw();
int map_id;
};
"main.cpp"
#include "DarkGDK.h"
#include "map.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
//debugger code
map debug;
// our main loop
while ( LoopGDK ( ) )
{
debug.control();
dbSync ( );
}
// return back to windows
return;
}
"map.cpp"
#include "DarkGDK.h"
#include "map.h"
map::map() //load default map
{
dbLoadImage("Media/Graphics/Tilesets/Debug Map/tile.PNG",1);
dbOpenToRead(1,"Data/Maps/m_debug0.dat");//load default map data
for(int x=0;x!=25;x++)//loop to store data
{
for(int y=0;y!=15;y++)
{
map::data[x][y]=dbReadByte(1);//store data in map array
}
}
map::map_id=0;
for(int m=1;m!=(25*15)+1;m++)
{
dbCreateAnimatedSprite(m,"Media/Graphics/Tilesets/Debug Map/tile.PNG",2,2,1);
}
}
map::~map()
{
}
int map::draw()//draw the map on the screen
{
for(int x=0;x!=25;x++)
{
for(int y=0;y!=15;y++)
{
dbSprite((x+1)*(y+x),x*32,y*32,1);
dbSetSpriteFrame((x+1)*(y+1),data[x][y]);
}
}
return 0;
}
int map::control()//controller for the class
{
map::draw();
return 0;
}
any help would be great. now it compiles fine. but i get a black screen and nothing else. I dont know why its not drawing, or why the values arent reading in right. gah!
Your signature has been erased by a mod - please reduce it to 600x120