Elements used in the Balls and Things games for the RETRO.

Dependents:   RETRO_BallsAndPaddle RETRO_BallAndHoles

Files at this revision

API Documentation at this revision

Comitter:
maxint
Date:
Sat Feb 28 19:40:48 2015 +0000
Parent:
5:065f19e08dcb
Child:
7:4fa3edaa1201
Commit message:
better collision detection on holes

Changed in this revision

Hole.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Hole.cpp	Sat Feb 28 16:32:03 2015 +0000
+++ b/Hole.cpp	Sat Feb 28 19:40:48 2015 +0000
@@ -64,7 +64,9 @@
 
 bool Hole::hasGoneIn(Circle cObject)
 {   // check if circular object has entered the hole
-    if(abs(cHole.getX()-cObject.getX())<=2 && abs(cHole.getY()-cObject.getY())<=2)
+    Line l(cHole.getX(), cHole.getY(), cObject.getX(), cObject.getY());
+
+    if(l.getSize()<=cHole.getRadius())
         return(true);
     return(false);
 }