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.
Dependencies: mbed
Diff: GraphicEngine/GraphicEngine.cpp
- Revision:
- 22:17ea297c19b5
- Parent:
- 19:6d9721ffc078
- Child:
- 27:e2af196bd9ab
- Child:
- 28:ab1ad440eff7
--- a/GraphicEngine/GraphicEngine.cpp Fri May 15 03:00:13 2020 +0000
+++ b/GraphicEngine/GraphicEngine.cpp Fri May 15 04:02:03 2020 +0000
@@ -2,28 +2,6 @@
N5110 lcd;
-// TO DO:
-// -> make multiple lanes of cars (first manually then automatically)
-// -> make one lane go other direction
-// -> make a safety lane
-// -> make a logs
-// -> make turtles
-// -> make the ocean (if collision with ocean then dead)
-// -> make multiple lives
-// -> point system
-// -> make the sprite images
-// -> make background object (sprite of entire screen)
-// -> make menu screen
-// -> collision
-// -> make sprite of safety lanes
-// -> make snake object
-// -> make turtles disappear after a certain time
-// BONUS:
-// --> make multiple levels
-// --> time constraint
-// -> crocodile (level 3) only (jump on body)
-// -> snake on log (level 3)
-
GraphicEngine::GraphicEngine(Chicken *chicken){
this->chick = chicken;
}
@@ -99,6 +77,25 @@
}
}
+void GraphicEngine::displayVehicle(int x, int row, char c)
+{
+ switch(obj)
+ {
+ case 'L': lcd.drawSprite(x, 48 - 4y, 4, 4, (int *)left_racer);
+ break;
+ case 'R' : lcd.drawSprite(x, 48 - 4*y, 4, 4, (int *)right_racer);
+ break;
+ case 'B': lcd.drawSprite(x, 48 - 4*y, 4, 6, (int *)bus);
+ break;
+ case 'N': lcd.drawSprite(x, 48 - 4*y, 4, 4, (int *)right_normal);
+ break;
+ case 'X': lcd.drawSprite(x, 48 - 4*y, 4, 4, (int *)left_normal);
+ break;
+ case '-': lcd.drawSprite(x, 48 - 4*y, 4, 4, FILL_WHITE);
+ break;
+ }
+}
+
void GraphicEngine::showIndividualCar(Car *car){
DrawCar temp_car;
@@ -160,28 +157,6 @@
}
}
-void GraphicEngine::drawVehicleSprites(char obj, int x, int y, int rows, int cols)
-{
- switch(obj)
- {
- case 'L':
- lcd.drawSprite(x, y, rows, cols, (int *)left_racer);
-
- case 'R' :
- lcd.drawSprite(x, y, rows, cols, (int *)right_racer);
-
- case 'B':
- lcd.drawSprite(x, y, rows, cols, (int *)bus);
-
- case 'N':
- lcd.drawSprite(x, y, rows, cols, (int *)right_normal);
-
- case 'X':
- lcd.drawSprite(x, y, rows, cols, (int *)left_normal);
- }
-}
-
-
// water = ','
void GraphicEngine::drawWater(char water, int x, int y, int row, in col)
{