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

2013/5/18

Animation

Gzuzfrk Gzuzfrk

2013/5/18

#
So I have my animation working and I tried making a counter but it is still way to fast how do I slow it way down. Its supposed to look like a kick so it really needs to be slow.
Gevater_Tod4711 Gevater_Tod4711

2013/5/18

#
If you use the modulo operator (%) that will help. E.g.
int counter = 0;

public void act() {
    counter++;
    if (counter % 3 == 0) {
        //This code will be executed only once in three acts;
       //If you use other valuse instead of 3 it takes longer or not so long if you use values smaler than 3;
    }
}
You need to login to post a reply.