All of my images are perfectly in the images folder and I've made an array with a corresponding for loop (which I've done successfully in previous games) but for some reason I'm receiving errors, can anybody help?
my code:
private String[] images = new String[13];
public void Protag(){
for(int i=1; i<13; i++)
images[i] = "Player" + i + ".png";
}
public void act(){
movement();
}
public void movement(){
if(Greenfoot.isKeyDown("W")){
setImage(images[4]);
setLocation(getX(),getY()-3);
}
if(Greenfoot.isKeyDown("A")){
setImage(images[7]);
setLocation(getX()-3,getY());
}
if(Greenfoot.isKeyDown("S")){
setImage(images[1]);
setLocation(getX(),getY()+3);
}
if(Greenfoot.isKeyDown("D")){
setImage(images[10]);
setLocation(getX()+3,getY());
}
}