How does one make an actor stop moving? Below is my code, the int "richting" is the movement of the actor. It is a fps game and when the actor is shot, it should stop moving, which doesn't work.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Human1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Human1 extends Animal
{
/**
* Act - do whatever the Human1 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public int deaths=0;
public int i=15;
public int richting=4;
public void act()
{
die();
move(richting);
beweeg();
i=i+1;
}
public void beweeg()
{
if (canSee(Wall.class))
{
richting=richting*-1;
}
if (canSee(Bullet.class) && deaths>=1)
{
int richting =0;
}
}
public void die()
{
if (canSee(Bullet.class) && deaths==0 && i>15)
{
GreenfootImage image=new GreenfootImage("Body.png");
setImage(image);
setLocation (getX(), getY()+30);
deaths=deaths+1;
i=0;
}
if (canSee(Bullet.class) && deaths==1 && i>15)
{
GreenfootImage image=new GreenfootImage("Body2.png");
setImage(image);
deaths=deaths+1;
i=0;
}
if (canSee(Bullet.class) && deaths==2 && i>15)
{
GreenfootImage image=new GreenfootImage("Body3.png");
setImage(image);
deaths=deaths+1;
i=0;
}
if (canSee(Bullet.class) && deaths==3 && i>15)
{
GreenfootImage image=new GreenfootImage("Body4.png");
setImage(image);
deaths=deaths+1;
i=0;
}
if (canSee(Bullet.class) && deaths==4 && i>15)
{
GreenfootImage image=new GreenfootImage("Body5.png");
setImage(image);
deaths=deaths+1;
i=0;
}
}
}

