Skip to content

Commit

Permalink
Add how-to-play message to remind the player to rapid fire if they ha…
Browse files Browse the repository at this point in the history
…ven't
  • Loading branch information
vgmoose committed Jun 5, 2016
1 parent 72f11f9 commit c285ff4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Binary file modified space.elf
Binary file not shown.
Binary file modified space_dbg.elf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int Application::exec()
void Application::executeThread(void)
{
/****************************> Globals <****************************/
struct SpaceGlobals mySpaceGlobals;
struct SpaceGlobals mySpaceGlobals = {};
//Flag for restarting the entire game.
mySpaceGlobals.restart = 1;

Expand Down
4 changes: 2 additions & 2 deletions src/program.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ struct SpaceGlobals{
int passwordEntered;
int allowInput;

// int displayHowToPlay;
// int firstShotFired;
int displayHowToPlay;
int firstShotFired;

};

Expand Down
27 changes: 14 additions & 13 deletions src/space.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ void p1Shoot(struct SpaceGlobals * mySpaceGlobals)
mySpaceGlobals->bullets[xx].m_x = 9*my_sin(theta); // 9 is the desired bullet speed
mySpaceGlobals->bullets[xx].m_y = 9*my_cos(theta); // we have to solve for the hypotenuese
mySpaceGlobals->bullets[xx].active = 1;
// mySpaceGlobals->firstShotFired = 1;
// mySpaceGlobals->displayHowToPlay = 0;
mySpaceGlobals->firstShotFired = 1;
if (mySpaceGlobals->score >= 1000)
mySpaceGlobals->displayHowToPlay = 0;
break;
}
}
Expand Down Expand Up @@ -132,9 +133,9 @@ void p1Move(struct SpaceGlobals *mySpaceGlobals) {
{
increaseScore(mySpaceGlobals, 10);

// if the score is at least 100 and a shot hasn't been fired yet, display a message about shooting
// if (mySpaceGlobals->score >= 100 && !mySpaceGlobals->firstShotFired)
// mySpaceGlobals->displayHowToPlay = 1;
// if the score is at least 50 and a shot hasn't been fired yet, display a message about shooting
if (mySpaceGlobals->score >= 50 && !mySpaceGlobals->firstShotFired)
mySpaceGlobals->displayHowToPlay = 1;
}

};
Expand Down Expand Up @@ -501,12 +502,12 @@ void renderTexts(struct SpaceGlobals *mySpaceGlobals)
__os_snprintf(lives, 255, "Lives: %d", mySpaceGlobals->lives);
drawString(55, -1, lives);

// if (mySpaceGlobals->displayHowToPlay)
// {
// char nag[255];
// __os_snprintf(nag, 255, "Touch and hold on the screen to rapid fire!");
// drawString(30, 17, nag);
// }
if (mySpaceGlobals->displayHowToPlay)
{
char nag[255];
__os_snprintf(nag, 255, "Touch and hold on the screen to rapid fire!");
drawString(20, 17, nag);
}

}

Expand Down Expand Up @@ -944,8 +945,8 @@ void addNewEnemies(struct SpaceGlobals *mySpaceGlobals)
void totallyRefreshState(struct SpaceGlobals *mySpaceGlobals)
{
initGameState(mySpaceGlobals);
// mySpaceGlobals->displayHowToPlay = 0;
// mySpaceGlobals->firstShotFired = 0;
mySpaceGlobals->displayHowToPlay = 0;
mySpaceGlobals->firstShotFired = 0;
mySpaceGlobals->lives = 3;
mySpaceGlobals->playerExplodeFrame = 0;
mySpaceGlobals->score = 0;
Expand Down

0 comments on commit c285ff4

Please sign in to comment.