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
Floors/Floors.h@3:116913e97fd7, 2019-04-10 (annotated)
- Committer:
- el17m2h
- Date:
- Wed Apr 10 19:07:41 2019 +0000
- Revision:
- 3:116913e97fd7
- Parent:
- 2:360a6c301a4e
- Child:
- 5:8814d6de77d0
I added 10 floors and made their position be random on the screen. I divided these in ranges in order to avoid the collision of the floors and also changed the width to have a random length between 10 and 15.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17m2h | 1:0001cb3eb053 | 1 | #ifndef FLOORS_H |
el17m2h | 1:0001cb3eb053 | 2 | #define FLOORS_H |
el17m2h | 1:0001cb3eb053 | 3 | |
el17m2h | 1:0001cb3eb053 | 4 | #include "mbed.h" |
el17m2h | 1:0001cb3eb053 | 5 | #include "N5110.h" |
el17m2h | 1:0001cb3eb053 | 6 | #include "Gamepad.h" |
el17m2h | 1:0001cb3eb053 | 7 | class Floors{ |
el17m2h | 1:0001cb3eb053 | 8 | public: |
el17m2h | 1:0001cb3eb053 | 9 | Floors(); |
el17m2h | 1:0001cb3eb053 | 10 | ~Floors(); |
el17m2h | 3:116913e97fd7 | 11 | void init(int x, int y, int width, int height); |
el17m2h | 1:0001cb3eb053 | 12 | void draw(N5110 &lcd); |
el17m2h | 1:0001cb3eb053 | 13 | Vector2D get_velocity(); //accesors |
el17m2h | 1:0001cb3eb053 | 14 | Vector2D get_pos(); |
el17m2h | 1:0001cb3eb053 | 15 | void set_pos(Vector2D p); // mutators |
el17m2h | 1:0001cb3eb053 | 16 | void set_velocity (Vector2D v); |
el17m2h | 1:0001cb3eb053 | 17 | |
el17m2h | 1:0001cb3eb053 | 18 | private: |
el17m2h | 1:0001cb3eb053 | 19 | int _height; |
el17m2h | 1:0001cb3eb053 | 20 | int _width; |
el17m2h | 1:0001cb3eb053 | 21 | int _x; |
el17m2h | 1:0001cb3eb053 | 22 | int _y; |
el17m2h | 1:0001cb3eb053 | 23 | Vector2D _velocity; |
el17m2h | 1:0001cb3eb053 | 24 | |
el17m2h | 1:0001cb3eb053 | 25 | }; |
el17m2h | 1:0001cb3eb053 | 26 | #endif |