this is the character and i want it to walk on a certain object and also make him jump.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Nose extends Characters
{
GifImage myStanding = new GifImage("Nuser.gif");
GifImage myRight = new GifImage("RightNuser.gif");
GifImage myLeft = new GifImage("LeftNuser.gif");
private int gravity;
private int vSpeed = 0;
private int acceleration = 2;
private boolean jumping;
private int jumpStrength = 20;
public void act(){
setImage(myStanding.getCurrentImage());
forward();
backward();
gravity--;
setLocation(getX(), getY() - gravity);
//checkForJump();
//checkForJump4();
}
public void forward(){
if(Greenfoot.isKeyDown("d")){
setLocation (getX ()+4 , getY() );
setImage(myRight.getCurrentImage());
}
}
public void backward(){
if(Greenfoot.isKeyDown("a")){
setLocation (getX ()-4 , getY() );
setImage(myLeft.getCurrentImage());
}
}
/** private void checkForJump()
{
if(Greenfoot.isKeyDown("w")){
gravity = 10; // this will make the character jump
}
}**/
/**private void checkForJump2()
{
Actor a = getOneIntersectingObject(flatblock.class);
if (a != null) {
gravity = 1; // this will make the character jump
}
}
private void checkForJump4()
{
if(isTouching(flatblock.class)){
gravity = 1; // this will make the character jump
}
}
}**/
}

