#172121 - zelbo - Sat Jan 16, 2010 8:08 pm
i'm getting the following error when i try to compile my latest monstrosity:
listCreatures and listTerrain are where i keep track of what is where for exactly this kind of check.
How do i make this work? Can you recommend a better way to do this?
I'm thinking i can just check the actual map, but i don't really have my actual map in place yet.
currently working on switching from iprintf-ing the game screen to sprites on a background.
hit this bump while pulling the monster class into it's own files, using the patater orange spaceship code as a framework.
Call in gameMain.cpp (yeah, i know. switch statements. i have some re-factoring to do.):
Function in monster.cpp:
Code: |
c:/devkitPro/projects/Quest_yarlds0.0.0f/source/gameMain.cpp: In function 'int m
ain()': c:/devkitPro/projects/Quest_yarlds0.0.0f/source/gameMain.cpp:799: error: no matc hing function for call to 'Monster::checkSpace(int&, int (*)[23][32], int (*)[23 ][32])' c:/devkitPro/projects/Quest_yarlds0.0.0f/include/monster.h:113: note: candidates are: int Monster::checkSpace(int, int*, int*) make[1]: *** [gameMain.o] Error 1 rm txtSprites.s avatar.s bgEGA8x8.s make: *** [build] Error 2 |
listCreatures and listTerrain are where i keep track of what is where for exactly this kind of check.
How do i make this work? Can you recommend a better way to do this?
I'm thinking i can just check the actual map, but i don't really have my actual map in place yet.
currently working on switching from iprintf-ing the game screen to sprites on a background.
hit this bump while pulling the monster class into it's own files, using the patater orange spaceship code as a framework.
Call in gameMain.cpp (yeah, i know. switch statements. i have some re-factoring to do.):
Code: |
switch (player->checkSpace(direction, &listCreatures, &listTerrain))
|
Function in monster.cpp:
Code: |
int Monster::checkSpace(int direction, int * plistCreatures, int * plistTerrain)
{ // potentials int potX; int potY; // 0=none 1=Creature 2=Wall 3=Water 4=Door int obstacle; /* 1) check creature array for monsters fight? 2) check terrain array for walls/water/door bump head/ swim? / open? */ switch (direction) { // first figure out what square we're looking at case (D_UP): potX = this->x; potY = this->y - 1; break; case (D_RIGHT): //this->x++; potX = this->x + 1; potY = this->y; break; case (D_DOWN): //this->y++; potX = this->x; potY = this->y + 1; break; case (D_LEFT): //this->x--; potX = this->x - 1; potY = this->y; break; default: ; // idle/rest? break; } if (plistCreatures[potY][potX] > 0) { obstacle = 1; } else if (plistTerrain[potY][potX] == 35) { obstacle = 2; } else if (plistTerrain[potY][potX] == 126) { obstacle = 3; } else if (plistTerrain[potY][potX] == 43) { obstacle = 4; } else { obstacle = 0; } return obstacle; } |