![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
Diff: GameEngine/RocketRacer.cpp
- Revision:
- 24:a049cef2cc2e
- Parent:
- 23:2ca9735b16ef
- Child:
- 25:7e3b6df93dd5
--- a/GameEngine/RocketRacer.cpp Fri Apr 19 19:50:23 2019 +0000 +++ b/GameEngine/RocketRacer.cpp Fri Apr 19 22:10:51 2019 +0000 @@ -2,34 +2,35 @@ //enemy sprite const int enemy[11][9] = { - { 0,0,0,0,1,0,0,0,0 }, - { 0,0,0,1,1,1,0,0,0 }, - { 0,0,1,1,1,1,1,0,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 1,1,1,1,1,1,1,1,1 }, - { 1,1,1,1,1,1,1,1,1 }, - { 1,1,1,1,1,1,1,1,1 }, - { 1,1,1,1,1,1,1,1,1 }, - { 1,1,1,1,1,1,1,1,1 }, + { 1,1,1,1,0,1,1,1,1 }, + { 1,1,1,0,0,0,1,1,1 }, + { 1,1,0,0,0,0,0,1,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 0,0,0,0,0,0,0,0,0 }, + { 0,0,0,0,0,0,0,0,0 }, + { 0,0,0,0,0,0,0,0,0 }, + { 0,0,0,0,0,0,0,0,0 }, + { 0,0,0,0,0,0,0,0,0 }, }; //player sprite const int rocket[11][9] = { - { 0,0,0,0,1,0,0,0,0 }, - { 0,0,0,1,1,1,0,0,0 }, - { 0,0,1,1,1,1,1,0,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 0,1,1,1,1,1,1,1,0 }, - { 0,0,1,1,1,1,1,0,0 }, - { 0,0,0,1,1,1,0,0,0 }, - { 0,0,0,0,1,0,0,0,0 }, - { 0,0,1,1,1,1,1,0,0 }, - { 0,0,1,1,1,1,1,0,0 }, + { 1,1,1,1,0,1,1,1,1 }, + { 1,1,1,0,0,0,1,1,1 }, + { 1,1,0,0,0,0,0,1,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 1,0,0,0,0,0,0,0,1 }, + { 1,1,0,0,0,0,0,1,1 }, + { 1,1,1,0,0,0,1,1,1 }, + { 1,1,1,1,0,1,1,1,1 }, + { 1,1,0,0,0,0,0,1,1 }, + { 1,1,0,0,0,0,0,1,1 }, }; + /* default constructor of the class and initializing th eprivate variables */ @@ -43,24 +44,24 @@ void RocketRacer::Main_Game_Display(N5110 &lcd){ lcd.clear(); //clears the lcd - lcd.drawRect(0,0,50,47,FILL_TRANSPARENT);//draws a transparent rectangle on the lcd + lcd.drawRect(0,0,46,47,FILL_BLACK);//draws a transparent rectangle on the lcd char score_buffer[14];//buffer to store the score char score_buffer1[14]; char level_buffer[14];//buffer to store the current level - char level_buffer1[14]; - + char level_buffer1[14]; //display score sprintf(score_buffer,"score"); lcd.printString(score_buffer,55,0); sprintf(score_buffer1,"%d",score); lcd.printString(score_buffer1,58,1); + lcd.drawLine(15, 2, 15,48,0); + lcd.drawLine(30, 2, 30,48,0); //display level sprintf(level_buffer,"Level"); lcd.printString(level_buffer,55,3); sprintf(level_buffer1,"%d",game_speed); lcd.printString(level_buffer1,58,4); - lcd.refresh();//refreshes the lcd to render - + lcd.refresh();//refreshes the lcd to render }