mbedアプリケーションボード( http://developer.mbed.org/cookbook/mbed-application-board )を使用した、簡単なシューティングゲーム
Dependencies: C12832 MMA7660 mbed
Revision 1:f5dbfedf7489, committed 2015-04-15
- Comitter:
- Arsenic
- Date:
- Wed Apr 15 09:43:36 2015 +0000
- Parent:
- 0:6ab01cb28fd0
- Commit message:
- ??????????????????????????;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6ab01cb28fd0 -r f5dbfedf7489 main.cpp --- a/main.cpp Wed Apr 15 08:22:43 2015 +0000 +++ b/main.cpp Wed Apr 15 09:43:36 2015 +0000 @@ -20,7 +20,7 @@ Ticker timeInt; /*ゲームステータス*/ -int racketP1,shot,enemyX=127,enemyY,enemyX2,life=3,lifeLED=3,lvl=2,score=0; +int rocket,shot,enemyX=127,enemyY,enemyX2,life=3,lifeLED=3,lvl=2,score=0; unsigned int randoms=0; void setHz(int Hz){ @@ -49,17 +49,17 @@ if(shot){ if(sownd<9)sownd = 1; - lcd.rect(9, (racketP1*8)+3, 127, (racketP1*8)+4, 1); + lcd.rect(9, (rocket*8)+3, 127, (rocket*8)+4, 1); } if(safeTime>0){ safeTime--; enemyY = randoms % 4; } - else if(enemyY == racketP1 && shot){ + else if(enemyY == rocket && shot){ if(sownd<9)sownd = 5; score++; -// lcd.fillcircle(enemyX+3, (enemyY*8)+4, 14, 1); +// lcd.fillcircle(enemyX+3, (enemyY*8)+4, 14, 1); //爆破エフェクト、ONにすると動作が不安定になる。 enemyX = 127; enemyY = randoms%4; if(!(score%20)){ @@ -79,7 +79,7 @@ if(enemyX > 120)enemyX2 = 127; else enemyX2 = enemyX+7; if(!safeTime)lcd.fillrect(enemyX, enemyY*8, enemyX2, (enemyY*8)+7, 1); - lcd.rect(0, racketP1*8, 7, (racketP1*8)+7, 1); + lcd.rect(0, rocket*8, 7, (rocket*8)+7, 1); switch(sownd){ case 0: @@ -201,14 +201,14 @@ randoms = 0; fireE = 0; shot = 1; - }else if(up && upE && racketP1!=0){ + }else if(up && upE && rocket!=0){ randoms = 0; upE = 0; - racketP1--; - }else if(down && downE && racketP1!=3){ + rocket--; + }else if(down && downE && rocket!=3){ randoms = 0; downE = 0; - racketP1++; + rocket++; } } } \ No newline at end of file