I cant find the error in my code.
The Player should move in a different speed ( fast and slow ).
there is an error in the movement code but i cant find it.
here is the code:
public void move()
{
if(Waffe.equals("Pfeil"))
{
if(Greenfoot.isKeyDown("w"))
{
this.setLocation(this.getX(), this.getY() - 5);
}
if(Greenfoot.isKeyDown("a"))
{
this.setLocation(this.getX() - 5, this.getY());
if(timer2==0)
{
this.getImage().mirrorHorizontally();
this.mirror = false;
this.timer2 = timer2+1;
}
}
if(Greenfoot.isKeyDown("s"))
{
this.setLocation(this.getX(), this.getY()+5);
}
if(Greenfoot.isKeyDown("d"))
{
this.setLocation(this.getX() + 5, this.getY());
if(mirror == false)
{
this.getImage().mirrorHorizontally();
this.mirror=true;
this.timer2 = 0;
}
}
}
if(Waffe.equals("Blue"))
{
if(Greenfoot.isKeyDown("w"))
{
this.setLocation(this.getX(), this.getY() - 2);
}
if(Greenfoot.isKeyDown("a"))
{
this.setLocation(this.getX() - 2, this.getY());
if(timer6==0)
{
this.getImage().mirrorHorizontally();
this.mirror = false;
this.timer6 = timer6+1;
}
}
if(Greenfoot.isKeyDown("s"))
{
this.setLocation(this.getX(), this.getY()+2);
}
if(Greenfoot.isKeyDown("d"))
{
this.setLocation(this.getX() + 2, this.getY());
if(mirror == false)
{
this.getImage().mirrorHorizontally();
this.mirror=true;
this.timer6 = 0;
}
}
}
}
I need this to work for my projekt.
Thank you