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

2018/12/17

How to change hitbox (?)

darkangel998 darkangel998

2018/12/17

#
Hello danpost, as you are the best in Greenfoot and you are the only one who is going to read me I ask you directly ... We are doing a practice of the University, and we do not know how to change the hitbox tete. We resize an object every time a worm is eaten, but the hitbox does not change. We need help! Help, I'm drowning!
danpost danpost

2018/12/17

#
darkangel998 wrote...
we do not know how to change the hitbox. We resize an object every time a worm is eaten, but the hitbox does not change.
Show codes you are using, so it can be tested. Also, give what version of greenfoot you are using. Please change your user icon, so that I will not skip over your posts by thinking they were mine.
darkangel998 darkangel998

2018/12/17

#
1
2
3
4
5
6
7
8
if(worm!=null){
            numofWorms++;
            getWorld().removeObject(worm);
            Greenfoot.playSound("eating.wav");
            // Cambia el tamaño de la ballena.
            image.scale(image.getWidth()+30, image.getHeight()+30);
            setImage(image);
        }
danpost danpost

2018/12/17

#
darkangel998 wrote...
<< Code Omitted >>
Cool -- I like the mix of blue and green in the user icon. I tested the code given and the hit box seems to coincide with the size of the actor as it grows.
You need to login to post a reply.