Hello so my object is supposed to fall but as it falls, instead of falling, the image is stretching all the way down :(((
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Sausage here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Sausage extends Actor
{
public Sausage()
{
GreenfootImage image = getImage();
int myNewHeight = (int)image.getHeight();
int myNewWidth = (int)image.getWidth();
image.scale(myNewWidth, myNewHeight);
}
/**
* Act - do whatever the Cheese wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
fall();
getSau();
if(getY() == 599) {
World world;
world = getWorld();
Mustard mus = new Mustard();
world.addObject(mus,650,15);
}
}
public void fall() //HINDI SMOOTH
{
setLocation(getX(), getY() + 1);
}
public void getSau()
{
Actor knife = getOneIntersectingObject(Knife.class);
if(knife!= null){
getWorld().removeObject(knife);
World realWorld = getWorld();
getSau();
RealGame levelone= (RealGame)realWorld; //accessing the counter every time trash gets hit by knife
Counter counter = levelone.getCounter(); //get actual counter from the world
counter.loseScore();
}
}
}