47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
package pr2.lambda.local;
|
|
|
|
import de.smits_net.games.framework.board.Board;
|
|
import de.smits_net.games.framework.image.AnimatedImage;
|
|
import de.smits_net.games.framework.image.ImagePack;
|
|
import de.smits_net.games.framework.image.StripedImage;
|
|
import de.smits_net.games.framework.sprite.AnimatedSprite;
|
|
import de.smits_net.games.framework.sprite.Direction;
|
|
|
|
import java.awt.Point;
|
|
|
|
/**
|
|
* Ein Alien.
|
|
*/
|
|
public class Alien extends AnimatedSprite {
|
|
|
|
/**
|
|
* Geschwindigkeit des Aliens X-Richtung.
|
|
*/
|
|
private static final int ALIEN_SPEED = 2;
|
|
|
|
/**
|
|
* Neues Alien anlegen.
|
|
*
|
|
* @param board das Spielfeld
|
|
* @param startPoint Start-Position
|
|
*/
|
|
public Alien(Board board, Point startPoint) {
|
|
super(board, startPoint, BoundaryPolicy.JUMP_BACK,
|
|
new AnimatedImage(50,
|
|
new ImagePack("pr2/lambda/local/",
|
|
"ship01", "ship02", "ship03")));
|
|
velocity.setVelocity(Direction.WEST, ALIEN_SPEED);
|
|
}
|
|
|
|
/**
|
|
* Alien explodieren lassen.
|
|
*/
|
|
public void explode() {
|
|
setActive(false);
|
|
setImages(new AnimatedImage(20,
|
|
new StripedImage("pr2/lambda/local/explosion_1" + ".png",
|
|
43)));
|
|
setInvisibleAfterFrames(70);
|
|
}
|
|
}
|