文件名称:用vc++编写的俄罗斯方块游戏
文件大小:3.57MB
文件格式:RAR
更新时间:2014-05-03 13:48:56
俄罗斯方块游戏
int CIBrick::shiftLeft (CBin*bin)
{
unsigned int posX;
posX=getPosX();
posX=posX-1;
setPosX(posX);
if(checkCollision(bin)==0)
{ setPosX(posX+1);
return 0;
}
return 1;
}
int CIBrick::shiftDown (CBin*bin)
{
unsigned int posY;
posY=getPosY();
posY=posY+1;
setPosY(posY);
if (checkCollision(bin)==0)
{
setPosY(posY-1);
return 0;
}
return 1;
}
int CIBrick::shiftRight (CBin*bin)
{
unsigned int posX;
posX =getPosX();
posX=posX+1;
setPosX(posX);
if(checkCollision(bin)==0)
{
setPosX(posX-1);
return 0;
}
return 1;
}
int CIBrick::rotateClockwise(CBin*bin)
{
unsigned int orientation,oldOrientation;
orientation=getOrientation();
oldOrientation=orientation;
if (orientation==3)
orientation=0;
else
orientation=orientation+1;
setOrientation(orientation);
if(checkCollision(bin)==0)
{
setOrientation(oldOrientation);
return 0;
}
return 1;
}
int CIBrick::checkCollision(CBin*bin)
{
unsigned int width;
unsigned int height;
unsigned char**image;
unsigned int orientation;
unsigned int posX;
unsigned int posY;
width=bin->getWidth();
height=bin->getHeight();
image=new unsigned char* [height];
for(unsigned int i=0;i
【文件预览】:
NewTetris
----NewTetris.dsp(5KB)
----StdAfx.cpp(211B)
----resource.h(1019B)
----NewTetris.opt(53KB)
----NewTetrisView.h(3KB)
----NewTetris.aps(28KB)
----bin.h(817B)
----MainFrm.h(1KB)
----bin.cpp(2KB)
----NewTetrisDoc.cpp(2KB)
----Debug()
--------NewTetris.ilk(386KB)
--------NewTetris.bsc(3.06MB)
--------NewTetris.exe(152KB)
--------vc60.pdb(364KB)
--------NewTetris.sbr(0B)
--------MainFrm.sbr(0B)
--------NewTetris.res(7KB)
--------vc60.idb(217KB)
--------bin.obj(7KB)
--------NewTetris.pch(6.57MB)
--------NewTetrisView.obj(72KB)
--------NewTetris.obj(23KB)
--------NewTetrisDoc.obj(15KB)
--------bin.sbr(0B)
--------brick.sbr(0B)
--------MainFrm.obj(20KB)
--------StdAfx.obj(103KB)
--------NewTetrisView.sbr(0B)
--------brick.obj(58KB)
--------StdAfx.sbr(1.31MB)
--------NewTetrisDoc.sbr(0B)
--------NewTetris.pdb(505KB)
----NewTetris.cpp(4KB)
----ReadMe.txt(4KB)
----brick.cpp(24KB)
----NewTetris.dsw(541B)
----StdAfx.h(1KB)
----NewTetris.rc(11KB)
----NewTetris.ncb(321KB)
----NewTetrisView.cpp(15KB)
----MainFrm.cpp(2KB)
----NewTetris.h(1KB)
----NewTetris.clw(2KB)
----brick.h(3KB)
----res()
--------NewTetrisDoc.ico(1KB)
--------NewTetris.rc2(401B)
--------NewTetris.ico(1KB)
--------Toolbar.bmp(1KB)
----NewTetrisDoc.h(1KB)
----NewTetris.plg(252B)