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

2013/4/24

can anyone help me make a class size bigger

1
2
emma123456789 emma123456789

2013/4/24

#
my game is where if a characterr touches another character it will increses in size to make it bigger?
Gevater_Tod4711 Gevater_Tod4711

2013/4/24

#
To change the actors size you need to change the image of the actor. You can use this method:
    public void scaleImage(GreenfootImage img, double size) {
        img.scale(((int) ((double) img.getWidth()*size/100.0)), (int) ((double) img.getHeight()*size/100.0));
    }
You need to call the method like this:
if (/*whatever is the condition*/) {
    scaleImage(getImage(), 110); 
    //110 is the percent value of the image so the image will be 10 % bigger than before;
}
emma123456789 emma123456789

2013/5/1

#
how do you stop it from growing bigger
Gevater_Tod4711 Gevater_Tod4711

2013/5/1

#
You need a abroading condition like a maximum size or a counter. For Example like this:
if (getImage().getWidth() < 500) {  
        scaleImage(getImage(), 110); 
}
//this will make your image grow until it reaches a width of 500 pixels;
I.AM.A.LION<ROAR> I.AM.A.LION<ROAR>

2013/5/1

#
aw emmas got a friend:)
emma123456789 emma123456789

2013/5/1

#
shh jessica&thanks gevater_tod4711
I.AM.A.LION<ROAR> I.AM.A.LION<ROAR>

2013/5/1

#
ahaha ly emma
Gevater_Tod4711 Gevater_Tod4711

2013/5/1

#
I don't have to understand what you both are talking about, right?
I.AM.A.LION<ROAR> I.AM.A.LION<ROAR>

2013/5/1

#
NONONO ITS GOOD you dont have to understand:)
emma123456789 emma123456789

2013/5/1

#
what is your real name gevater_tod4711
I.AM.A.LION<ROAR> I.AM.A.LION<ROAR>

2013/5/1

#
Gevater_Tod4711 can you answer my question please?
Gevater_Tod4711 Gevater_Tod4711

2013/5/1

#
Tobias
emma123456789 emma123456789

2013/5/8

#
ok whats the code to stop it from growing bigger then to move again ????????????????
emma123456789 emma123456789

2013/5/8

#
??????????????????
emma123456789 emma123456789

2013/5/8

#

helpppppppppppppppppppppppppppppppppppppppppppp
There are more replies on the next page.
1
2