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: CrossyChicken/CrossyChicken.cpp
- Revision:
- 9:d210eede4a1b
- Parent:
- 8:52794de935b2
- Child:
- 11:cc5861abfca5
diff -r 52794de935b2 -r d210eede4a1b CrossyChicken/CrossyChicken.cpp
--- a/CrossyChicken/CrossyChicken.cpp Tue May 12 05:14:17 2020 +0000
+++ b/CrossyChicken/CrossyChicken.cpp Tue May 12 22:04:05 2020 +0000
@@ -28,6 +28,7 @@
Car log1Lane[2];
Car lo[2];
Car logger[2];
+Car vop[2];
int screenW = 84;
int screenH = 48;
@@ -89,7 +90,12 @@
logger[1].setSeperation(20);
logger[0].setRow(9);
logger[1].setRow(9);
-
+
+ // log lane 3
+ vop[0].setSeperation(0);
+ vop[1].setSeperation(20);
+ vop[0].setRow(10);
+ vop[1].setRow(10);
//keep reading and processing user input
while(1) {
@@ -117,7 +123,8 @@
for(int b = 0; b < 2; b++){
moveCar(&lo[b], 2, 1);
- moveCar(&logger[b], 2, 2);
+ // moveCar(&logger[b], 2, 2);
+ moveCar(&vop[b], 1, 2);
}
@@ -127,8 +134,9 @@
graphics.showCar(fourthLane);
graphics.showCar(log1Lane);
graphics.showCar(lo);
- //graphics.showCar(logger);
-
+ graphics.showCar(logger);
+ graphics.showCar(vop);
+
graphics.showChicken();
process_input();
@@ -140,21 +148,26 @@
//if it is not in a log
for(int x = 0; x < 2; x++){
setCollision(&log1Lane[x]);
-
+ setCollision(&lo[x]);
+ setCollision(&logger[x]);
+ setCollision(&vop[x]);
+
if(attach){
frogOnLog(&log1Lane[x]);
+ frogOnLog(&lo[x]);
+ frogOnLog(&logger[x]);
+ frogOnLog(&vop[x]);
+
}
}
if(!attach){
graphics.print();
- }
-
+ }
}
-
-
+
graphics.refresh();
- wait_ms(200);
+ wait_ms(70);
}
}
@@ -188,9 +201,9 @@
// make the frog move same speed as log
// if the frog moves then detach
void CrossyChicken::frogOnLog(Car *log) {
- // if(log->seperation != 0){
- chicken.x += 0.4;
- // }
+ if(log->seperation != 0){
+ chicken.x += 1.0;
+ }
}
//moves the chicken around the grid
@@ -207,7 +220,7 @@
chicken.down = grid + chicken.y;
//display the new state of the chicken
- graphics.showChicken();
+ //graphics.showChicken();
//wait_ms(30);
}