ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
14:529f798adae4
Parent:
13:10851784af9a
Child:
15:4efa04a6a376
--- a/Floors/Floors.cpp	Thu Apr 18 14:54:51 2019 +0000
+++ b/Floors/Floors.cpp	Sun Apr 21 16:10:19 2019 +0000
@@ -1,5 +1,4 @@
 #include "Floors.h"
-
 Floors::Floors(){
 }
 Floors::~Floors(){
@@ -11,30 +10,30 @@
 //  x-coordinate initially random: screen =84 (visible to 84-FLOORS_WIDTH): 0 left, 70 right
     int _array[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74}; 
     // excluding centre so doodler falls to the floor at bottom
-    _pos.x = _array[rand()%(sizeof(_array) / sizeof *_array)];
-    _pos.y = y;
+    _position.x = _array[rand()%(sizeof(_array) / sizeof *_array)];
+    _position.y = y;
 }
 
 void Floors::draw(N5110 &lcd){
-    lcd.drawRect(_pos.x, _pos.y, _width, _height, FILL_BLACK);
+    lcd.drawRect(_position.x, _position.y, _width, _height, FILL_BLACK);
 }
 
 void Floors::update(){
 // when they leave the screen they will re-appear in random x-coordinate so that 10 floors are always on screen
-    _pos = get_pos();
-    if (_pos.y > 48 ){ 
-    _pos.y = 0;      
-    _pos.x = rand()% 74;
+    _position = get_position();
+    if (_position.y > 48 ){ 
+    _position.y = 0;      
+    _position.x = rand()% 74;
     }
-    set_pos(_pos);
+    set_position(_position);
 }
 
-Vector2D Floors::get_pos(){
-    Vector2D p = {_pos.x,_pos.y};
+Vector2D Floors::get_position(){
+    Vector2D p = {_position.x,_position.y};
     return p;
 }
 
-void Floors::set_pos(Vector2D p){
-    _pos.x = p.x;
-    _pos.y = p.y;
+void Floors::set_position(Vector2D pos){
+    _position.x = pos.x;
+    _position.y = pos.y;
 }
\ No newline at end of file