Here are 2 screenshots from the finished version of Killjoy:
Killjoy is quite a simple game (its my first) And this is roughly how it works:
The playstation libraries are initialised and the mode is set. | |
Variables and definitions are set up along with structure definitions. | |
The game map, lighting and object arrays are set up. | |
Sprites, boxes and lines are all set up. |
Loop is set up:
In the loop:
Playstation pad data is read and processed, | |
collisions are detected | |
objects are moved | |
screen buffer is changed and next one is processed |
Killjoy Technical information:
All of the levels are array based making collision detection and screen display easy.
The system uses a double buffer so each time the screen is drawn the next screen is processed saving time as while the screen is being drawn the program loop can carry on using VSync_Callback();
Here is the collision detection program:
int ObjectHandler( GsSPRITE *spriteo, GsSPRITE *sprite_two )
{
if( spriteo->x -spriteo->mx> (sprite_two->x + sprite_two->w-1) ||
sprite_two->x > ((spriteo->x
-spriteo->mx)+ spriteo->w-1) ||
(spriteo->y-spriteo->my) >
(sprite_two->y + sprite_two->h-1) ||
sprite_two->y > ((spriteo->y
-spriteo->my)+ spriteo->h-1) )
{
return(0); // NO HIT
}
else
{
return(1); // HIT
}
}// BoxCollision