Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: homepage/homepage.cpp
- Revision:
- 6:cbd9e1f26a10
- Parent:
- 5:e3a9f0548922
--- a/homepage/homepage.cpp Fri May 15 19:57:40 2020 +0000
+++ b/homepage/homepage.cpp Fri May 15 21:16:14 2020 +0000
@@ -1,13 +1,13 @@
#include "homepage.h"
Homepage::homepage(){
- mode = 0;
+
}
Homepage::~homepage()
{}
-void Homepage::welcome(N5110 &lcd,BusOut &output,Sound &sound)
+void Homepage::welcome(N5110 &lcd,BusOut &output,Bgm &bgm)
{
//show "Spaceship"
lcd.printString(" Spaceship ",0,1);
@@ -24,7 +24,7 @@
void Homepage::over(N5110 &lcd,BusOut &output)
{
//show game over
- lcd.printString(" Game Over! ",0,1);
+ lcd.printString(" You are failed ",0,1);
lcd.printString(" Press Start ",0,4);
lcd.refresh();
wait(1.0f);
@@ -40,11 +40,11 @@
while(1){
lcd.printString(" Press Start to start ",0,0);
- lcd.printString(" A Rules",0,4);
+ lcd.printString(" A Rules",0,2);
lcd.refresh();
if(buttonA){
- wait(0.3f);
+ wait(0.5f);
lcd.clear();
//show the game rule
rules(lcd,buttonA);
@@ -57,12 +57,12 @@
}
-void homepage::displayCurScore(N5110 &lcd,int score){
+void Homepage::displayCurScore(N5110 &lcd,int score){
char buffer[4];
sprintf(buffer,"%d",score);
lcd.printString(buffer,0,0);
}
-void homepage::drawEverything(N5110 &lcd){
+void Homepage::drawEverything(N5110 &lcd){
int Spaceship[15][10] = {
0,0,0,0,0,0,0,0,0,0,
@@ -82,10 +82,10 @@
0,0,0,1,1,1,1,0,0,0,
0,0,0,0,0,0,0,0,0,0,
//draw spaceship
- Bitmap sprite2(_Spaceship, 10, 10);
- sprite2.render(lcd, 9, 28);
+ Bitmap sprite2(_Spaceship, 16, 10);
+ sprite2.render(lcd, 28, 28);
}
-void homepage::rules(N5110 &lcd,InterruptIn &buttonA) {
+void Homepage::rules(N5110 &lcd,InterruptIn &buttonA) {
//show game rules
while(1) {
lcd.clear();
@@ -107,7 +107,7 @@
lcd.clear();
while(1){
if(score>10){
- //score > 10 means player have enough scores to pay for continue playing
+ //if score > 10, player have enough POINTS to replay when he is defeated.
lcd.printString("Play Again?",0,0);
lcd.printString("Price: 10",0,2);
lcd.printString("X Yes",0,3);
@@ -124,7 +124,7 @@
}
}else{
// player doesn't have enough scores , so game over directly
- lcd.printString("Fail!",0,1);
+ lcd.printString("Fail",0,1);
lcd.printString("Press Y return",0,2);
lcd.refresh();
if(buttonY){