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






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;
/*w  ww  .j av  a  2  s .  c o  m*/
import android.gameengine.icadroids.alarms.Alarm;
import android.gameengine.icadroids.alarms.IAlarm;
import android.gameengine.icadroids.engine.GameEngine;
import android.gameengine.icadroids.engine.GameFPSCounter;
import android.gameengine.icadroids.forms.GameForm;
import android.gameengine.icadroids.forms.IFormInput;
import android.gameengine.icadroids.input.OnScreenButtons;
import android.gameengine.icadroids.objects.GameObject;
import android.gameengine.icadroids.objects.MoveableGameObject;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.Button;

/**
 * Deze test test GameObject, MoveableGameObject, Forms, Alarms, AnimatedSprite
 * en OnscreenButtons.
 * 
 * @author Bas van der Zandt
 * 
 */
public class TestGameBas extends GameEngine implements IAlarm, IFormInput {

  private MoveableGameObject testObject = new MoveableGameObject();
  //private GameObject testObject2 = new GameObject();
  GameForm gf;
  //Alarm am = new Alarm(1, 300, this);
  //testGameObjectBas testObjectBas = new testGameObjectBas();
  private MoveableGameObject hoi = new MoveableGameObject();

  public TestGameBas() {

    animateStart();

    OnScreenButtons.use = true;
    OnScreenButtons.feedback = true;
    setScreenLandscape(true);
    
    //GameFPSCounter.USE_FPS_COUNTER = true;
      animateStart();
    
  }
  
  public void animateStart(){
    testObject.setSprite("tile6", 10);
    testObject.startAnimate();
    testObject.setAnimationSpeed(30);

    addGameObject(testObject, 10, 10);
      hoi.setSprite("fishframes", 4);
    
    
    hoi.startAnimate();
    hoi.setAnimationSpeed(0);
    
    hoi.setFrameNumber(0);
    hoi.setSpeed(0);
    addGameObject(hoi, 100, 100);
    
  
    
  }
  

  @Override
  protected void initialize() {

    
  }

  @Override
  public void update() {

    // Log.d("update", "een update");
    if (OnScreenButtons.dPadUp) {
      testObject.setSpeed(5);
      testObject.setDirection(0);
      testObject.setFriction(0.1);
    }
    if (OnScreenButtons.dPadDown) {
      testObject.setDirectionSpeed(180, 5);
      testObject.setFriction(0.1);
    }
    if (OnScreenButtons.dPadRight) {
      testObject.setDirectionSpeed(90, 5);
      testObject.setFriction(0.2);
    }
    if (OnScreenButtons.dPadLeft) {
      testObject.movePlayer(-5, 0);
    }
    if (OnScreenButtons.buttonA) {
      testObject.jumpToStartPosition();
    }

  }

  public void triggerAlarm(int alarmID) {
    gf = new GameForm("testform", this, this);

  }

  public void buttonClicked(Button button) {

  }

  public void formElementClicked(View touchedElement) {
    System.out.println("geklikt!");
    // gf.sendToast("geklikt!", 1);

    if (gf.getElementName(touchedElement).equals("Pointless")) {
      System.out.println("Pointless");
      gf.sendToast(gf.getTextFromTextfield("tekstVeldje"), 3);
    }
    if (gf.getElementName(touchedElement).equals("hoi")) {
      gf.sendToast("Hallo", 5);
    }

  }

}




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