Reputation: 13
Im working on this curs, folow all steps but got error. Problem is
public boolean playerShotTouches(Rectangle boundingBox) {
Iterator<AnimatedSprite> i = shots.iterator();
while(i.hasNext())
{
AnimatedSprite shot = i.next();
if(Intersector.intersectRectangles(shot.getBoundingBox(), boundingBox))
{
i.remove();
return true;
}
}
return false;
}
android studio report:
Error:(108, 27) error: method intersectRectangles in class Intersector cannot be applied to given types; required: Rectangle,Rectangle,Rectangle found: Rectangle,Rectangle reason: actual and formal argument lists differ in length
Upvotes: 1
Views: 109
Reputation: 1034
Can you post the relevant code from the course? The intersectRectangles method has always take 3 Rectangles as parameters. The 3rd one is the intersection rectangle to the area of overlap. So your code could do something like this:
AnimatedSprite shot = i.next();
Rectangle myIntersection = new Rectangle();
if(Intersector.intersectRectangles(shot.getBoundingBox(), boundingBox, myIntersection))
Upvotes: 0