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: Floors/Floors.cpp
- Revision:
- 9:5e53bca2a4c2
- Parent:
- 8:90e789413e0b
- Child:
- 10:e1d2289705ef
--- a/Floors/Floors.cpp Tue Apr 16 16:16:08 2019 +0000
+++ b/Floors/Floors.cpp Tue Apr 16 19:51:12 2019 +0000
@@ -9,22 +9,32 @@
_height = height;
_width = width;
- _x = x;
- _y = y;
+ _pos.x = x;
+ _pos.y = y;
_velocity.x = 0;
_velocity.y = 0;
}
void Floors::draw(N5110 &lcd){
- lcd.drawRect(_x, _y, _width, _height, FILL_BLACK);
+ lcd.drawRect(_pos.x, _pos.y, _width, _height, FILL_BLACK);
}
-void Floors::update(){
- _current_pos = get_pos();
- _current_vel = get_velocity();
+void Floors::update(Vector2D current_pos, Vector2D current_vel){
+ _current_pos = current_pos;
+ _current_vel = current_vel;
+ // if they are below the y bottom then they re-appear at top in a random place
-
+}
+
+Vector2D Floors::get_velocity(){
+ Vector2D v = {_velocity.x,_velocity.y};
+ return v;
+}
+
+Vector2D Floors::get_pos(){
+ Vector2D p = {_pos.x,_pos.y};
+ return p;
}
@@ -33,17 +43,7 @@
_velocity.y = v.y;
}
-Vector2D Floors::get_velocity(){
- Vector2D v = {_velocity.x,_velocity.y};
- return v;
-}
-
-Vector2D Floors::get_pos(){
- Vector2D p = {_x,_y};
- return p;
-}
-
void Floors::set_pos(Vector2D p){
- _x = p.x;
- _y = p.y;
+ _pos.x = p.x;
+ _pos.y = p.y;
}
\ No newline at end of file