I need a scroller for a mariobros style game which only scrolls horizontally.
I have tried multiple codes from the internet but none worked.
pls help
   
   
            public class Waluigi extends Spieler
{
    int ySpeed;
    int xSpeed;
    int apexTimer;
    int richtung=2;
    int animZaehler;
    int fallzaehler;
    private GreenfootImage bildL, bildR, bildLs, bildRs, bild1L, bild2L, bild3L, bild4L, bild1R, bild2R, bild3R, bild4R;
    public Waluigi()
    {
        bildL = new GreenfootImage("WaluigiL.png");
        bildR = new GreenfootImage("WaluigiR.png");
        bildLs = new GreenfootImage("WaluigiLS.png");
        bildRs = new GreenfootImage("WaluigiRS.png");
        bild1L = new GreenfootImage("WaluigiLL1.png");
        bild2L = new GreenfootImage("WaluigiLL2.png");
        bild3L = new GreenfootImage("WaluigiLL3.png");
        bild4L = new GreenfootImage("WaluigiLL4.png");
        bild1R = new GreenfootImage("WaluigiRL1.png");
        bild2R = new GreenfootImage("WaluigiRL2.png");
        bild3R = new GreenfootImage("WaluigiRL3.png");
        bild4R = new GreenfootImage("WaluigiRL4.png");
    }
    public void act()
    {
        animZaehler++;
        fallzaehler++;
        richtung();
        movement();
        animationen();
        int groundLevel = getWorld().getHeight() - getImage().getHeight()/2;
        boolean onGround = (isTouching(ground.class));
        if (!onGround) // in middle of jump
        {   if (ySpeed == 0 && apexTimer > 0) apexTimer--; // run apex timer
            if (ySpeed == 0 && apexTimer > 0) return; // apex timer still running
            ySpeed++;// adds gravity effect
            setLocation(getX(), getY()+ySpeed-2); // fall (rising slower or falling faster)
            if (getY()>=groundLevel) setLocation(getX(), groundLevel); // set on ground
        }
        else // on ground
        {
            if (Greenfoot.isKeyDown("space")) // jump key detected
            {
                ySpeed = -20; // add jump speed
                setLocation(getX(), getY()+ySpeed); // leave ground
                apexTimer = 8;  // set apex timer (adjust value to suit)
            }}
        
    }
    public void richtung()
    {
        if (Greenfoot.isKeyDown("D"))richtung= 1;
        if (Greenfoot.isKeyDown("A"))richtung= 2;
    }
    public void movement()
    {
        if (Greenfoot.isKeyDown("D")&&!Greenfoot.isKeyDown("M"))move(2);
        if (Greenfoot.isKeyDown("A")&&!Greenfoot.isKeyDown("M"))move(-2);
        if (Greenfoot.isKeyDown("D")&&Greenfoot.isKeyDown("M"))move(5);
        if (Greenfoot.isKeyDown("A")&&Greenfoot.isKeyDown("M"))move(-5);
    }
    public void animationen()
    {
        int groundLevel = getWorld().getHeight() - getImage().getHeight()/2;
        boolean onGround = (getY() == groundLevel);
        if (!onGround)
        {
            if (richtung==1)setImage(bildRs);
            if (richtung==2)setImage(bildLs);
            animZaehler=0;   
        }
        if (onGround)
        {
         if (!Greenfoot.isKeyDown("A")&&!Greenfoot.isKeyDown("D"))
         {
            if (richtung==1)setImage(bildR);
            if (richtung==2)setImage(bildL);
            animZaehler=0;
         }
         if (Greenfoot.isKeyDown("M"))
           {
               if (animZaehler==1)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==6)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==11)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==16)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==21)animZaehler=1;
           }
         else
         if (!Greenfoot.isKeyDown("M"))
           {
               if (animZaehler==1)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==11)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==21)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==31)
               {
                   if (Greenfoot.isKeyDown("A"))bildWechselnL();
                   if (Greenfoot.isKeyDown("D"))bildWechselnR();
               }
               if (animZaehler==41)animZaehler=1;
           }
        }   
        if (animZaehler==21)animZaehler=1;   
    }
    private void bildWechselnL()
    {
        if (getImage() == bild1L)
        {
            setImage(bild2L);
        }
        else
        setImage(bild1L);
    }
    private void bildWechselnR()
    {
        if (getImage() == bild1R)
        {
            setImage(bild2R);
        }
        else
        setImage(bild1R);
    }
}