Android Open Source - game-api-android Game Engine Test Game






From Project

Back to project page game-api-android.

License

The source code is released under:

MIT License

If you think the Android project game-api-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package testGames.gameEngineTest;
//from  w w w . j  a va 2 s  .com
import java.util.Random;

import android.gameengine.icadroids.alarms.Alarm;
import android.gameengine.icadroids.alarms.IAlarm;
import android.gameengine.icadroids.forms.IFormInput;
import android.gameengine.icadroids.input.TouchInput;
import android.view.View;

/**
 * Deze test 'game' test alarms, forms, gameObject, MoveableGameObject,
 * gameEngine en TouchInput.
 * 
 * @author Bas
 * 
 */
public class GameEngineTestGame extends DebugEngine implements IAlarm,
    IFormInput {
  TestGameObject testObject = new TestGameObject();
  Alarm am = new Alarm(1, 60, this);
  Alarm am2 = new Alarm(2, 20, this);
  randomObject ro = new randomObject();

  public GameEngineTestGame() {
    System.out.println("Hello tests!");

    addGameObject(testObject, 10, 10);
    setPlayer(testObject);
    addGameObject(ro, 10, 10);
    TouchInput.use = true;

  }

  @Override
  public void initialize() {
    triggerAlarm(12345); //custom call of (system) alarm to test alarms
  }

  @Override
  public void update() {
    super.update();
    if (TouchInput.onPress) {
      testObject.moveTowardsAPoint(TouchInput.xPos, TouchInput.yPos);
    }
  }

  public void triggerAlarm(int alarmID) {
    super.triggerAlarm(alarmID);
    if (alarmID == 1) {
      randomObject ro = new randomObject();
      Random r = new Random();
      addGameObject(ro, r.nextInt(getScreenHeight()),
          r.nextInt(getScreenWidth()));
      am.restartAlarm();
    }

  }

  public void formElementClicked(View touchedElement) {
    super.formElementClicked(touchedElement);
    System.out.println("geklikt!");
  }
}




Java Source Code List

android.gameengine.icadroids.alarms.Alarm.java
android.gameengine.icadroids.alarms.IAlarm.java
android.gameengine.icadroids.dashboard.DashboardImageView.java
android.gameengine.icadroids.dashboard.DashboardTextView.java
android.gameengine.icadroids.engine.GameEngine.java
android.gameengine.icadroids.engine.GameFPSCounter.java
android.gameengine.icadroids.engine.GameThread.java
android.gameengine.icadroids.engine.GameView.java
android.gameengine.icadroids.engine.Viewport.java
android.gameengine.icadroids.forms.GameForm.java
android.gameengine.icadroids.forms.IFormInput.java
android.gameengine.icadroids.forms.ViewCreator.java
android.gameengine.icadroids.forms.ViewRemover.java
android.gameengine.icadroids.input.MotionSensor.java
android.gameengine.icadroids.input.OnScreenButton.java
android.gameengine.icadroids.input.OnScreenButtons.java
android.gameengine.icadroids.input.TouchInput.java
android.gameengine.icadroids.objects.GameObject.java
android.gameengine.icadroids.objects.MoveableGameObject.java
android.gameengine.icadroids.objects.collisions.CollidingObject.java
android.gameengine.icadroids.objects.collisions.ICollision.java
android.gameengine.icadroids.objects.collisions.TileCollision.java
android.gameengine.icadroids.objects.graphics.AnimatedSprite.java
android.gameengine.icadroids.objects.graphics.Sprite.java
android.gameengine.icadroids.persistence.GamePersistence.java
android.gameengine.icadroids.sound.GameSound.java
android.gameengine.icadroids.sound.MusicPlayer.java
android.gameengine.icadroids.tiles.GameTiles.java
android.gameengine.icadroids.tiles.Tile.java
com.android.vissenspel.Monster.java
com.android.vissenspel.StrawberryControler.java
com.android.vissenspel.Strawberry.java
com.android.vissenspel.Vis.java
com.android.vissenspel.Vissenkom.java
game.MyAndroidGame.java
testGames.AndroidCraft_demo.java
testGames.FormTest.java
testGames.Player.java
testGames.TestGameBas.java
testGames.TestGameLex.java
testGames.TestGameRoel.java
testGames.gameEngineTest.DebugEngine.java
testGames.gameEngineTest.GameEngineTestGame.java
testGames.gameEngineTest.TestGameObject.java
testGames.gameEngineTest.debugObject.java
testGames.gameEngineTest.randomObject.java
testGames.testGameObjectBas.java
testGames.testGame.java