contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Tue Mar 26 13:07:12 2019 +0000
Revision:
8:b547037f42be
Parent:
7:7e50cac5e0f4
Child:
9:edb39a8334ee
fixed joystick left and right read

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 6:958376d55d70 1 #include "RocketRacer.h"
OmarAlebiary 6:958376d55d70 2
OmarAlebiary 8:b547037f42be 3 Gamepad Mypad;
OmarAlebiary 6:958376d55d70 4
OmarAlebiary 7:7e50cac5e0f4 5 void RocketRacer::MainGameDisplay(N5110 &lcd){
OmarAlebiary 7:7e50cac5e0f4 6
OmarAlebiary 6:958376d55d70 7 lcd.clear();
OmarAlebiary 7:7e50cac5e0f4 8 lcd.drawRect(0,0,52,48,FILL_TRANSPARENT);
OmarAlebiary 7:7e50cac5e0f4 9 char buffer[14];
OmarAlebiary 7:7e50cac5e0f4 10 // char buffer1[14];
OmarAlebiary 7:7e50cac5e0f4 11 // int score=64;
OmarAlebiary 7:7e50cac5e0f4 12
OmarAlebiary 7:7e50cac5e0f4 13 sprintf(buffer,"score");
OmarAlebiary 7:7e50cac5e0f4 14 lcd.printString(buffer,55,0);
OmarAlebiary 7:7e50cac5e0f4 15 //sprintf(buffer1,"%d",score);
OmarAlebiary 7:7e50cac5e0f4 16 // lcd.printString(buffer1,58,1);
OmarAlebiary 6:958376d55d70 17 lcd.refresh();
OmarAlebiary 7:7e50cac5e0f4 18
OmarAlebiary 7:7e50cac5e0f4 19 }
OmarAlebiary 7:7e50cac5e0f4 20
OmarAlebiary 8:b547037f42be 21 void RocketRacer::GameLoop(Gamepad &pad){
OmarAlebiary 8:b547037f42be 22
OmarAlebiary 8:b547037f42be 23
OmarAlebiary 8:b547037f42be 24 Direction d=pad.get_direction();
OmarAlebiary 8:b547037f42be 25
OmarAlebiary 8:b547037f42be 26 if(d==W){
OmarAlebiary 8:b547037f42be 27 printf("its left\n");
OmarAlebiary 8:b547037f42be 28 }
OmarAlebiary 8:b547037f42be 29 else if(d==E){
OmarAlebiary 8:b547037f42be 30 printf("its Right\n");
OmarAlebiary 8:b547037f42be 31 }
OmarAlebiary 8:b547037f42be 32 else if(d==CENTRE){
OmarAlebiary 8:b547037f42be 33 printf("its middle\n");}
OmarAlebiary 8:b547037f42be 34
OmarAlebiary 8:b547037f42be 35 }
OmarAlebiary 8:b547037f42be 36
OmarAlebiary 7:7e50cac5e0f4 37 void RocketRacer::EndGame(N5110 &lcd){
OmarAlebiary 7:7e50cac5e0f4 38 lcd.clear();
OmarAlebiary 8:b547037f42be 39 lcd.printString("Game over!!!",5,0);
OmarAlebiary 8:b547037f42be 40 lcd.printString("Better Luck ",2,2);
OmarAlebiary 8:b547037f42be 41 lcd.printString("next time",2,3);
OmarAlebiary 8:b547037f42be 42 lcd.refresh();
OmarAlebiary 7:7e50cac5e0f4 43
OmarAlebiary 7:7e50cac5e0f4 44 }