Spence123
Spence123

Reputation: 107

LibGDX overlaps methods arguments

I'm following a set of LibGDX tutorials. As I understand it, the overlaps method operates on a rectangle object, and takes another rectangle object as an parameter, as I can see from this page.

I am using the method like this:

if(bill.bounds.overlaps(steve.bounds)){
    System.out.println("Stop touching me bill!");
}

I keep getting an error that says:

the methods overlaps(rectangles) is undefined for the type rectangles.

Upvotes: 1

Views: 463

Answers (1)

Boldijar Paul
Boldijar Paul

Reputation: 5495

The problem is with your import.

Go somewhere up in your class and search for the rectangle import, delete that line and replace it with the libGDX rectangle class (import com.badlogic.gdx.math.Rectangle)

Upvotes: 3

Related Questions