I'm a new Android developer that's developing a simple twist on the Tron 
game with GPS movement, but I'm having trouble implementing player's 
intersecting.

Right now, my player's trails are Paths that I move to co-ordinates and draw 
the co-ordinate difference as a line on the canvas.

The path class offers no such intersection method that I can find, so I 
resorted to using Regions which I've tested an intersection to work with 2 
regular Rectangles, but I can't make a Region using Region.setPath for some 
reason. From my understanding, the path needs to be closed to form an area 
for it to create a Region, which isn't exactly what I need.

Is there a way to create a region off a path, and not the area the path 
creates? ie: If the path were a straight line of 10px thick, how do I make a 
region that is a line of 10px thick? Or alternatively, are there other ways 
to check for 2 paths intersecting?

A short code sample:

Path p1path = new Path();
p1path.moveTo(startPos,startPos); 
p1path.lineTo(newPos,newPos);
p1path.moveTo(newPos, newPos);
Region p1region = new Region();
p1region.setPath(p1path, new Region(0,0,480,800); // this is where the region 
isn't setting as I thought it would...

// do same for p2
if(p1.quickReject(p2)) // checks for intersection

Thanks :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to