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

4 days ago

resizing actor (smaller)

annika.g annika.g

4 days ago

#
I am new to greenfoot and need this for a schoolproject. I downloaded an image from the internet and used it as the image for my actor. The problem is that when I try to create a new version of this actor, it won't fit into my world because it's way too big. I haven't programmed anything in the actors editor, because I want to tackle this problem first. It just needs to be way smaller, like more than half its size. Maybe somebody can help me with that?
danpost danpost

4 days ago

#
You can scale an image. For example:
GreenfootImage image = getImage();
image.scale(image.getWidth()*2/5, image.getHeight()*2/5);
Add a constructor to the Actor subclass to perform the scaling.
annika.g annika.g

4 days ago

#
Ok thank you, but that didn't really work. Another question/idea: Can I make this new actor the size of an actor that's already there and already has the correct size? Couldn't I just tell this new actor to adapt to the size of the already correct one?
danpost danpost

4 days ago

#
annika.g wrote...
Ok thank you, but that didn't really work.
What happened and what codes are you using? In what way is it not what you want? Did you set the image as the default image of objects created from the class?
Can I make this new actor the size of an actor that's already there and already has the correct size? Couldn't I just tell this new actor to adapt to the size of the already correct one?
Better to fix from above. If total fail, could try something along these lines.
You need to login to post a reply.