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: Engine/Engine.cpp
- Revision:
- 6:848d1e4c1a31
- Parent:
- 5:8814d6de77d0
- Child:
- 7:0d9cee90ab0d
diff -r 8814d6de77d0 -r 848d1e4c1a31 Engine/Engine.cpp
--- a/Engine/Engine.cpp Sat Apr 13 17:37:52 2019 +0000
+++ b/Engine/Engine.cpp Sat Apr 13 19:50:00 2019 +0000
@@ -11,6 +11,7 @@
_doodler_radius = doodler_radius;
_dood.init(_doodler_radius);
+ _dood.jump();
// screen WIDTH =84 (but floors only visible to 70): 0 left, 70 right
// FLOORS_WIDTH = 10
@@ -86,4 +87,43 @@
_f9.update();
_f10.update();
+ check_floors_collision(pad);
+
}
+
+void Engine::check_floors_collision(Gamepad &pad){
+ // read floors and doodler's positions
+ Vector2D doodler_pos =_dood.get_pos();
+
+ if (doodler_pos.y = _f1y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f2y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f3y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f4y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f5y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f6y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f7y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f8y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f9y - 3){
+ _dood.jump();
+ }
+ if (doodler_pos.y = _f10y - 3){
+ _dood.jump();
+ }
+
+}
\ No newline at end of file