Re: Lua problems...
Posted: Thu Nov 20, 2008 6:49 pm
Use the debugger to step through?
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
The main loop in the engine?MarauderIIC wrote:Use the debugger to step through?
MarauderIIC wrote:Yeah, since you said it's not working in the engine either.
Code: Select all
void ToFile(char msg[40]) {
Debug << msg << std::endl;
Debug.flush();
}
if(y > 1) {
Log("start");
Map.close();
Log("end");
}
GyroVorbis wrote:I'm curious as to how exactly your map system works. Are you not actually reading in your maps and storing them in some sort of array? Are you actually parsing through the map file in-game?
Code: Select all
//globals.h
std::fstream Map;
char map_name[40];
//lua.h
int KillMap(lua_State* L) {
Map.close();
return 1;
}
int SetMap(lua_State* L) {
strcpy(map_name, lua_tostring(L, -1));
Map.open(map_name, std::fstream::in);
return 1;
}
//level.h
void LevelClass::MapTiles() {
//layer 1
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap1[j][i];
}
}
//layer 2
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap2[j][i];
}
}
//layer 3
for(int j=0;j<18;j++) {
for(int i=0;i<18;i++) {
Map >> LevelMap3[j][i];
}
}
}
The coordinates do update properly.MarauderIIC wrote:Reading all this again, it looks like perhaps your coordinates aren't updating properly.
Code: Select all
if(ytile > 1) {
SetPlayerYX(5, 5);
}