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

2019/12/12

How do i scale down an image?

NateysWowed NateysWowed

2019/12/12

#
This is my first year of Greenfoot and im still learning new codes. I have an image that i need to scale down and here is the code i have: /** * Write a description of class BlockOne here. * * @author (your name) * @version (a version number or a date) */ public class BlockOne extends Blocks { /** * Act - do whatever the BlockOne wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { scaleDown(); } public void scaleDown() { GreenfootImage image = getImage(); image.scale(5, 5); setImage(image); }
danpost danpost

2019/12/12

#
Q1: Is the scaling a one time thing? Q2: When is scaling to take place? Q3; Scaling is to go between what sizes (specifically)?
NateysWowed NateysWowed

2019/12/12

#
i have the scaling in one class and it is not going to be changed. i have the problem where the code is typed and compiled and it doesn't scale down the image when placed into the world
danpost danpost

2019/12/12

#
So -- A1: Yes. A2: Upon creation. A3: As shown. Change 'void act()' to 'BlockOne()'.
You need to login to post a reply.