This site requires JavaScript, please enable it in your browser!
Greenfoot back
AnneMacaroni
AnneMacaroni wrote ...

2013/1/3

How to get the size of the image of a class from the world?

AnneMacaroni AnneMacaroni

2013/1/3

#
I know how to get the size of the set image of a class inside the class getImage().getWidth(); OR getImage().getHeight(); But since I'm making a platform out of bricks (a rectangle image; brick class) and must add the objects in the world, how do I get the size of the image from the world class? Is it possible or do I have to do it by trial and error? Thanks :D
vonmeth vonmeth

2013/1/3

#
You can call those methods on an object just fine in the world class.
Brick brick = new Brick();
int brickWidth = brick.getImage().getWidth();
AnneMacaroni AnneMacaroni

2013/1/3

#
lol it's actually pretty simple :P thanks!
You need to login to post a reply.