46 hours to assignment submission [Archive] - C Board

PDA

View Full Version : 46 hours to assignment submission


technoXavage
12-17-2003, 04:59 AM
Hi all.....I'm currently assigned to develop a spaceship shooting game and it is supposed technically achievable within 30 hours. I doubt I shall be getting much slleep the next 2 days......can u guys take a look at what the final product should look like here (http://nickchong.com/galatea.zip) and the engine here (http://nickchong.com/shellv6.zip) and comment me on how I should take on this challenge. Much help is appreciated. Thanks a lot and have a nice day.

technoXavage
12-17-2003, 05:25 AM
i've done the spaceship rotation bit......i'm not sure how to thrust

technoXavage
12-17-2003, 06:37 AM
thrusting done...moving on to terrain n perhaps shooting...time left 44 hrs 20 mins

technoXavage
12-17-2003, 07:53 AM
terrain problem....when i run the game....the buildings appear for less than 1 second and then it is totally gone.......how come??

technoXavage
12-17-2003, 08:07 AM
/class Terrain
{
private: double xCoord, yCoord;
int type; //type of terrain from 0 to 4
MySurface* pMySurface;

RECT sourceRect, destRect;
double width, height;

public:
Terrain(int t, double x1,MySurface* p)
{
xCoord = x1;
yCoord = 0.0;
type = t;
pMySurface = p;
//calculate column and row number of the image
double x,y;
switch(type)
{
case 0: x=0;width=128;y=124;height=132;break;
case 1: x=129;width=61;y=35;height=221;break;
case 2: x=270;width=100;y=185;height=71;break;
case 3: x=383;width=97;y=205;height=51;break;
case 4: x=500;width=140;y=230;height=26;break;
case 5: x=191;width=75;y=35;height=221;break;
}
sourceRect.top=(int)y;
sourceRect.bottom=(int)(y+height);
sourceRect.left=(int)x;
sourceRect.right=(int)(x+width);
LogError("sourceRect");
LogError(x);
LogError(x+width);
}
double getX()
{
return xCoord;
}
double getWidth()
{
return width;
}


int getType()
{
return type;
}
void setType(int t)
{
type = t;
}
void draw()
{
destRect.top = (int)(470-gdViewpointY-height);
destRect.bottom= (int)(600-gdViewpointY);
destRect.left = (int)(xCoord-gdViewpointX);
destRect.right=(int)(xCoord+width-gdViewpointX);
/*destRect.left=(int)xCoord-gdViewpointX+100;
destRect.right=(int)xCoord+width-gdViewpointX;
destRect.bottom=(int)600-gdViewpointY;
destRect.top=(int)470-gdViewpointY;*/
LogError("destRect");
LogError(destRect.left);
LogError(destRect.right);
//to copy from secondary surface to back buffer
pDrawEngine->Blit(destRect,sourceRect,pMySurface);
}
};
Terrain* terrainArr[NUMOFTERRAIN];
int GameInit()
{
.....
srand(time(NULL));
double x=0.0;
terrainArr[0] = new Terrain(rand()%5,x,pgTerrainSurface);
LogError(terrainArr[0]->getType());
x+=terrainArr[0]->getWidth();
for(int i=1;i<NUMOFTERRAIN;i++)
{
terrainArr[i] = new Terrain(rand()%5,x,pgTerrainSurface);
LogError(terrainArr[i]->getType());
x+=terrainArr[i]->getWidth();
LogError(x);
}
count = 1;
x =0.0;
widthDrawn = 0.0;
.....
}
int GameMain{
...
DrawTerrain()
.....}
void DrawTerrain()
{
//if(count==NUMOFTERRAIN)
//count=0;
widthDrawn = 0.0;
for(int i=count;i<NUMOFTERRAIN;i++)
{
LogError("inside for loop in terrain");
terrainArr[i]->draw();
widthDrawn+=terrainArr[i]->getWidth();
count++;
if(widthDrawn>=SCREENWIDTH)
{
LogError("widthDrawn>=SCREENWIDTH");
widthDrawn = 0;
break;
}
}
}

technoXavage
12-17-2003, 09:35 AM
/class Terrain
{
private: double xCoord, yCoord;
int type; //type of terrain from 0 to 4
MySurface* pMySurface;

RECT sourceRect, destRect;
double width, height;

public:
Terrain(int t, double x1,MySurface* p)
{
xCoord = x1;
yCoord = 0.0;
type = t;
pMySurface = p;
//calculate column and row number of the image
double x,y;
switch(type)
{
case 0: x=0;width=128;y=124;height=132;break;
case 1: x=129;width=61;y=35;height=221;break;
case 2: x=270;width=100;y=185;height=71;break;
case 3: x=383;width=97;y=205;height=51;break;
case 4: x=500;width=140;y=230;height=26;break;
case 5: x=191;width=75;y=35;height=221;break;
}
sourceRect.top=(int)y;
sourceRect.bottom=(int)(y+height);
sourceRect.left=(int)x;
sourceRect.right=(int)(x+width);
LogError("sourceRect");
LogError(x);
LogError(x+width);
}
double getX()
{
return xCoord;
}
double getWidth()
{
return width;
}


int getType()
{
return type;
}
void setType(int t)
{
type = t;
}
void draw()
{
destRect.top = (int)(470-gdViewpointY-height);
destRect.bottom= (int)(600-gdViewpointY);
destRect.left = (int)(xCoord-gdViewpointX);
destRect.right=(int)(xCoord+width-gdViewpointX);
/*destRect.left=(int)xCoord-gdViewpointX+100;
destRect.right=(int)xCoord+width-gdViewpointX;
destRect.bottom=(int)600-gdViewpointY;
destRect.top=(int)470-gdViewpointY;*/
LogError("destRect");
LogError(destRect.left);
LogError(destRect.right);
//to copy from secondary surface to back buffer
pDrawEngine->Blit(destRect,sourceRect,pMySurface);
}
};
Terrain* terrainArr[NUMOFTERRAIN];
int GameInit()
{
.....
srand(time(NULL));
double x=0.0;
terrainArr[0] = new Terrain(rand()%5,x,pgTerrainSurface);
LogError(terrainArr[0]->getType());
x+=terrainArr[0]->getWidth();
for(int i=1;i<NUMOFTERRAIN;i++)
{
terrainArr[i] = new Terrain(rand()%5,x,pgTerrainSurface);
LogError(terrainArr[i]->getType());
x+=terrainArr[i]->getWidth();
LogError(x);
}
count = 1;
x =0.0;
widthDrawn = 0.0;
.....
}
int GameMain{
...
DrawTerrain()
.....}
void DrawTerrain()
{
//if(count==NUMOFTERRAIN)
//count=0;
widthDrawn = 0.0;
for(int i=count;i<NUMOFTERRAIN;i++)
{
LogError("inside for loop in terrain");
terrainArr[i]->draw();
widthDrawn+=terrainArr[i]->getWidth();
count++;
if(widthDrawn>=SCREENWIDTH)
{
LogError("widthDrawn>=SCREENWIDTH");
widthDrawn = 0;
break;
}
}
}

technoXavage
12-17-2003, 09:44 AM
the funny thingis that i can see like 8 buildings if i comment the count++ in the void DrawTerrain().....

revelation437
12-22-2003, 10:56 PM
none of ur links work there homie

Fahrenheit
12-22-2003, 11:04 PM
I'm glad you are keeping us updated. 6 replies to yourself? Jesus...

frenchfry164
12-23-2003, 03:15 PM
I've seen doubles,
I've seen triple,
but never have I seen a sexpost!

sorry, couldn't resist :p