# cheat sheet by mikeholy

VIEWS: 33 PAGES: 2

• pg 1
```									                                                                                                     //------------------------------------------------------------------------------------------------
Shmup Development Sheet                                                                              NormalizeAngle(angle)
{
Thom Robertson                                      5/20/08                                                            while (angle < -PI)
angle += PI*2;
while (angle > PI)
angle -= PI*2;
TurnTowardsPoint( myX, myY, targetX, targetY, myCurrentDirection, myTurnRate)
•     Make a player                                                                                  {
directionToTarget = atan2(targetX - myX, targetY - myY);
•     Make a bunch of enemies                                                                                          NormalizeAngle(directionToTarget);
NormalizeAngle(myCurrentDirection);

•     Move them every frame, have them create bullets
resultAngle = directionToTarget – myCurrentDirection;
NormalizeAngle(resultAngle);

•
if (resultAngle > myTurnRate)
Move the bullets every frame                                                                                                       resultAngle = myTurnRate;
if (resultAngle < myTurnRate * -1)
•     Check for enemy-bullet collision every frame                                                                                       resultAngle = myTurnRate * -1;
myCurrentDirection = myCurrentDirection + resultAngle;
•     Keep going, even if all the enemies or the player is dead                                      }
//------------------------------------------------------------------------------------------------
Object box
{
What is a ship?                                                                                      }
int left, top, right, bottom;

{

•     Health value
if (box1.left > box2.right)
return FALSE;

•
if (box1.top > box2.bottom)
X and Y positions                                                                                                                  return FALSE;
if (box1.right < box2.left)
•     Path logic and data                                                                                                                return FALSE;
if (box1.bottom < box2.top)
•     Reference to the art                                                                                                               return FALSE;

•     Animation state                                                                                }
return TRUE;

•     Bullet/missile launch state
//------------------------------------------------------------------------------------------------

•     Bullets and Explosions are very similar to ships!                                              Translate Offsets to Vectors
•Get distance with Pythagoras
//------------------------------------------------------------------------------------------------   •Get direction with Atan2 (Arctangent)
Main()
{
SetupEverything();
CreatePlayer();
Translate Vectors to Offsets
CreateAllEnemies();                                                                •X = sin(direction) * distance
done = false;
while (done == false)                                                              •Y = cos(direction) * distance
{
TickPlayer();
TickEnemyList();
TickBulletList();
DrawPlayer();
DrawEnemyList();
Shmup Hardcore Market
DrawBulletList();
if (EscapeKeyPressed() == TRUE)
done = TRUE;
•     Hardcore players want everything!

}
WaitForNextFrame();
•     Want a few finely-tuned levels

}
ShutDownEverything();                                                              •     Want the most intricate bosses

//------------------------------------------------------------------------------------------------
•     Demand 2D top-down
TimerFunction()
{
TickPlayer();
•     Demand frantic action (bullet hell, scraping)
TickEnemyList();
TickBulletList();
// some systems, like Flash and Torque, do the drawing for you
DrawPlayer();
DrawEnemyList();
DrawBulletList();
Shmup Casual Market
if (EscapeKeyPressed() == TRUE)
done = TRUE;                                                     •     Play because they are comfy with the gameplay style
•
}

//------------------------------------------------------------------------------------------------
They want a more leisurely, easy experience
TickBulletList()
{
ForEach( bullet)
•     They want to “pick up and play” for a few minutes of
{                                                                                        mindless fun
x = x + dx;
y = y + dy;
if (BulletOffScreen())
•     They want funny faces or chickens, not spaceships
{
}                                                                Web resources:
ForEach(enemy)
{                                                                http://insomnia.ac/archive/glossaries/shooting/
if (Collides(enemy, bullet))
{                                              http://shootthecore.moonpod.com/2006/06/shooter-