我正在开发的一款太空侵略者游戏遇到了一个非常奇怪的问题。基本上我得到一个访问冲突错误:
SpaceInvaders.exe 中 0x5edad442 (msvcr100d.dll) 处的未处理异常:0xC0000005:访问冲突读取位置 0x00000000。
当我包含下面的代码时。调试时,Visual Studio 将我带到“strcmp.asm”。请注意,我没有在我的任何代码中使用 strcmp() 。代码有什么问题,还是超出我所包含的范围的问题?谢谢你的帮助
const char* invarray[] = {"invader0.png", "invader1.png", "invader2.png", "invader3.png", "invader4.png"};
int i=0;
//Creates 55 invaders
for (int y=0; y<250; y+=50){
for (int x=0; x<550;x+=50){
Invader inv(invarray[y/50], x+50, y+550, 15, 15, 1, false, 250);
invaders[i] = inv;
}
}
入侵者构造函数:
Invader::Invader(const char *pic, int x, int y, int w, int h, bool dir, bool des, int point) : MovingObject(pic, x, y, w, h) , direction(dir), destroyed(des), b(0), points(point){};
移动对象构造函数
MovingObject::MovingObject(const char *pic, int x, int y, int w, int h):picture(pic), positionX(x), positionY(y), width(w), height(h) {};