Hello!
I am making a sort of bmx game. and i want that my biker can make a wheelie but i have no clue how to make that. Can anyone help me?
thanks a lot!
GreenfootImage image = new GreenfootImage("imageName.png");
int backAxleX = ??, backAxleY = ??;
int x = backAxleX;
if (x < image.getWidth()/2) x = image.getWidth()-backAxleX;
GreenfootImage image2 = new GreenfootImage(x*2, backAxleY*2)
image2.drawImage(image, x-backAxleX, 0);
setImage(image2);
public void act ()
{
// moveHorizontally();
// moveVertically();
// int setRotation = getRotation();
if(Greenfoot.isKeyDown("down"))
{
turn(-3);
GreenfootImage image = new GreenfootImage("biker.png");
int backAxleX = 21, backAxleY = 14;
int x = backAxleX;
if (x < image.getWidth()/2) x = image.getWidth()-backAxleX;
GreenfootImage image2 = new GreenfootImage(x*2, backAxleY*2);
image2.drawImage(image, x-backAxleX, 0);
setImage(image2);
} else {
//turn(3);
//setRotation(getRotation() + 0);
//turn(getRotation());
}
}System.out.println("width: "+image.getWidth()+"\theight: "+image.getHeight());public void act()
{
if (Greenfoot.mouseClicked(this))
{
MouseInfo mouse = Greenfoot.getMouseInfo();
if (mouse == null) return;
System.out.println("BACK AXLE\tx: "+mouse.getX()-(getX()-40)+"\ty: "+mouse.getY()-(getY()-40));
}
}