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
Revision 7:1dce07fd0867, committed 2020-05-11
- Comitter:
- el19tb
- Date:
- Mon May 11 22:57:53 2020 +0000
- Parent:
- 6:e285eaf8bdcd
- Child:
- 8:52794de935b2
- Commit message:
- added log lanes and log functionality
Changed in this revision
--- a/CrossyChicken/CrossyChicken.cpp Mon May 11 21:16:12 2020 +0000
+++ b/CrossyChicken/CrossyChicken.cpp Mon May 11 22:57:53 2020 +0000
@@ -24,6 +24,10 @@
Car firstLane[2];
Car secondLane[2];
Car thirdLane[3];
+Car fourthLane[3];
+Car log1Lane[2];
+Car lo[2];
+Car logger[2];
//class that whill show objects
GraphicEngine graphics(chickenptr);
@@ -38,21 +42,47 @@
//first lane of left racers
firstLane[0].setSeperation(0);
- firstLane[1].setSeperation(40);
+ firstLane[1].setSeperation(20);
firstLane[0].setRow(2);
firstLane[1].setRow(2);
secondLane[0].setSeperation(0);
- secondLane[1].setSeperation(30);
+ secondLane[1].setSeperation(20);
secondLane[0].setRow(3);
secondLane[1].setRow(3);
- thirdLane[0].setSeperation(30);
- thirdLane[1].setSeperation(0);
- thirdLane[2].setSeperation(50);
+ thirdLane[0].setSeperation(0);
+ thirdLane[1].setSeperation(20);
+ thirdLane[2].setSeperation(40);
thirdLane[0].setRow(4);
thirdLane[1].setRow(4);
thirdLane[2].setRow(4);
+
+ fourthLane[0].setSeperation(10);
+ fourthLane[1].setSeperation(30);
+ fourthLane[2].setSeperation(50);
+ fourthLane[0].setRow(5);
+ fourthLane[1].setRow(5);
+ fourthLane[2].setRow(5);
+
+ // log lane 1
+ log1Lane[0].setSeperation(0);
+ log1Lane[1].setSeperation(20);
+ log1Lane[0].setRow(7);
+ log1Lane[1].setRow(7);
+
+ // log lane 2
+ lo[0].setSeperation(10);
+ lo[1].setSeperation(30);
+ lo[0].setRow(8);
+ lo[1].setRow(8);
+
+ // log lane 3
+ logger[0].setSeperation(0);
+ logger[1].setSeperation(20);
+ logger[0].setRow(9);
+ logger[1].setRow(9);
+
//keep reading and processing user input
while(1) {
@@ -60,9 +90,8 @@
graphics.showChicken();
process_input();
- for(int i = 0; i < 2; i++){
+ for(int i = 0; i < 2; i++){
moveCar(&firstLane[i], 2, (-2)); // change x position (moving)
- // collision(&firstLane[i]);
}
for(int x = 0; x < 2; x++){
@@ -71,23 +100,44 @@
for(int t = 0; t < 3; t++){
moveCar(&thirdLane[t], 2, 1);
- //collision(&thirdLane[t]);
+ }
+
+ for(int c = 0; c < 3; c++){
+ moveCar(&fourthLane[c], 2, 1);
+ }
+
+ for(int v = 0; v < 2; v++){
+ moveCar(&log1Lane[v], 2, 1);
+ }
+
+ for(int b = 0; b < 2; b++){
+ moveCar(&lo[b], 2, 1);
+ moveCar(&logger[b], 2, 2);
}
graphics.showCar(firstLane);
graphics.showCar(secondLane);
graphics.showCar(thirdLane);
-
+ graphics.showCar(fourthLane);
+ graphics.showCar(log1Lane);
+ graphics.showCar(lo);
+ //graphics.showCar(logger);
+
for(int t = 0; t < 3; t++){
collision(&thirdLane[t]);
}
graphics.refresh();
- wait_ms(100);
+ wait_ms(50);
}
}
+// log intersects then frog.x = log[i].speed
+// frog is attached function
+// detach the frog when user goes up or down
+// if the frog is back to the safe zone detatch also
+// whenever the frog moves detach
//A moves right
//X moves upward
//B moves downward
--- a/Frog/Car.cpp Mon May 11 21:16:12 2020 +0000
+++ b/Frog/Car.cpp Mon May 11 22:57:53 2020 +0000
@@ -12,7 +12,7 @@
screenHeight = 48;
screenWidth = 84;
- size = 2;
+ size = 3;
// width of all vehicles
vehicle.width = grid * size;
--- a/GraphicEngine/GraphicEngine.cpp Mon May 11 21:16:12 2020 +0000
+++ b/GraphicEngine/GraphicEngine.cpp Mon May 11 22:57:53 2020 +0000
@@ -44,7 +44,7 @@
// draw to screen
// create an enum to determine the vehicle type
- for(int y = 0; y < 2; y++){
+ for(int y = 0; y < 4; y++){
showIndividualCar(&car[y]);
}
}
@@ -61,7 +61,7 @@
}
void GraphicEngine::displayCar(DrawCar &size){
- lcd.drawRect(size.x, size.y, size.width, size.height, FILL_BLACK);
+ lcd.drawRect(size.x, size.y, size.width, size.height, FILL_TRANSPARENT);
}
void GraphicEngine::printTest(){