I'm currently working on my game: http://www.greenfoot.org/scenarios/8167 and i have a question:
Is it possible to programm, that if an enemy gets me, every enemy will stop moving an jump (for example).
Thanks in advantage :)
//first you have to implement this:
import java.util.List;
public void allertAllEnemys() {
List<Enemy> enemys = getWorld().getObjects(Enemy.class);
if (enemys != null && !enemys.isEmpty()) {
for (Enemy enemy : enemys) {
enemy.jump();//or any other mehtod;
}
}
}//in your enemy class;
private int speed;
public void jump() {
//let your enemy jump;
}
public void incrementSpeed(int speed) {
this.speed = speed;
}