2 import org
.alterverse
.control
.*;
3 import org
.alterverse
.speech
.tts
;
4 import org
.alterverse
.sound
.*;
5 import org
.alterverse
.game
.*;
6 import org
.alterverse
.shapes
.*;
7 import org
.alterverse
.world
.*;
9 public class AlienRemake
extends GameContext
{
16 class Alien
extends MovableObject
{
20 public Alien(Shape shape
) {
22 land
=new Sound("sounds/land.ogg");
23 move
=new Sound("sounds/alien.ogg");
24 explode
= new Sound("sounds/explode.ogg");
25 // add sounds to list which should be moved with object
29 move
.setPitch(Math
.random()*0.4+0.9);
33 public void process() {
34 double nz
= Math
.random()*0.1;
35 double nx
= Math
.random()*1-0.5;
36 setPosition(getX()+nx
,getY(),getZ()+nz
);
45 public void removeSounds() {
46 for (Sound s
: getSounds())
47 SoundManager
.removeSound(s
);
50 public void onBump(GameObject othr
) {
53 if (othr
instanceof Beam
) {
62 class Beam
extends MovableObject
{
64 public Beam(Shape shape
) {
66 laser
=new Sound("sounds/laser.ogg");
71 public void process() {
72 setPosition(getX(),getY(),getZ()-1);
79 public void removeSounds() {
80 for (Sound s
:getSounds())
81 SoundManager
.removeSound(s
);
84 public void onBump(GameObject othr
) {
90 public AlienRemake() {
91 engine
= new GameEngine(this);
93 area
.setGravity(false);
94 tts
.speak("Welcome to alien remake! ");
97 theme
= new Sound("sounds/theme.mp3", true);
103 public void process() {
106 if (bcl
.isKeyDown(Keys
.LEFT
)) {
108 SoundManager
.setListenerPosition(x
,0,0);
110 if (bcl
.isKeyDown(Keys
.RIGHT
)) {
112 SoundManager
.setListenerPosition(x
,0,0);
117 double lx
= Math
.random()*10-5;
118 double lz
= Math
.random()*10-20;
119 area
.add(new Alien(new Box(lx
,-1,lz
,2,2,2)));
124 public void keyDown(int key
) {
125 if (bcl
.isKeyDown(Keys
.LSHIFT
))
131 area
.saveJs("space.sav");
134 area
.loadJs("space.sav");
143 area
.add(new Beam(new Box(x
-0.125,-1,0,0.25,1,0.5)));
148 public void destroy() {
152 public static void main(String
[] args
) {