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: N5110 PinDetect PowerControl mbed
Diff: Entity.h
- Revision:
- 13:7ab71c7c311b
- Parent:
- 12:8178fad5e660
- Child:
- 15:d5eb13c4c1c6
diff -r 8178fad5e660 -r 7ab71c7c311b Entity.h
--- a/Entity.h	Fri May 08 23:51:26 2015 +0000
+++ b/Entity.h	Sat May 09 13:56:14 2015 +0000
@@ -12,13 +12,17 @@
         Entity() {x = y = width = height = vx = vy = 0; facingLeft = true; onGround = false;}
         Entity(int x, int y, int w, int h) : x(x), y(y), width(w), height(h) {vx = vy = 0; facingLeft = true; onGround = false;}
         
-        int x, y;       /// Position of entity
+        int x, y;       /// Position of entity (origin: left upper corner)
         int vx, vy;     /// Velocity of entity
         int width;      /// Width of entity
         int height;     /// Height of entity
         
         bool facingLeft; /// True if the entity is facing left
         bool onGround;  /// True if entity is standing on the ground.
+        
+        int getRight() {return x + width - 1;}      /// Returns x-position of the right edge
+        int getBottom() {return y + height - 1;}    /// Returns y-position of the bottom edge
+        
 };
 
 #endif
\ No newline at end of file