how to visualize a rectangle

357 views Asked by At

I have two rectangles in Libgdx but they seem not to overlap right. Is there a way so I see where the rectangles are?

I have this:

Body2.setSize(72, 72);
Body2.setPosition(20, squiddyY);
Body.setHeight(Assets.sprite_body.getHeight());
Body.setPosition(pipe1X, Assets.sprite_body.getY()+Assets.sprite_body.getHeight());
if(Body2.overlaps(Body)){
    squiddyY=1000;
}

but it looks like body is half size of sprite_body(or the Y is just too low?) and is a bit behind it (the X location of sprite_body is pipe1X). Maybe i'm putting it at the wrong place so visualizing it will really help.

1

There are 1 answers

1
TomGrill Games On

You can draw shapes with ShapeRenderer http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html

The link includes examples.