Back to project page game-api-android.
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.
package testGames; // w w w. j ava 2 s .c o m import android.gameengine.icadroids.engine.GameEngine; import android.gameengine.icadroids.engine.GameView; import android.gameengine.icadroids.engine.Viewport; import android.gameengine.icadroids.input.OnScreenButtons; import android.gameengine.icadroids.objects.GameObject; import android.gameengine.icadroids.objects.MoveableGameObject; import android.gameengine.icadroids.sound.GameSound; import android.gameengine.icadroids.sound.MusicPlayer; /** * Deze game test de sounds en viewport. * * @author Lex van de Laak en Leon van Kleef * */ public class TestGameLex extends GameEngine { //private MoveableGameObject testObj = new MoveableGameObject(); //private GameObject testObject2 = new GameObject(); Viewport view = Viewport.getInstance(); public TestGameLex() { // addGameObject(testObj, 100, 100, .9f); //setPlayer(testObj); //testObj.setSprite("kat_01"); //addGameObject(testObject2, 200, 200, 0.2f); //testObject2.setSprite("kat_01"); } @Override protected void initialize() { OnScreenButtons.use = true; OnScreenButtons.feedback = true; //setBackground("kat_01"); setZoomFactor(.2f); setMapDimensions(4000, 3000); GameSound.addSound(0, "lucas"); GameSound.addSound(1, "ding"); } @Override public void update() { if (OnScreenButtons.dPadUp) { //testObj.setSpeed(0); //testObj.movePlayer(0, -5); } if (OnScreenButtons.dPadDown) { //testObj.setSpeed(0); //testObj.movePlayer(0, 5); } if (OnScreenButtons.dPadRight) { //testObj.movePlayer(5, 0); } if (OnScreenButtons.dPadLeft) { //testObj.movePlayer(-5, 0); } if (OnScreenButtons.select) { // GameSound.stopSound(1); // GameSound.pauseSound(0); // MusicPlayer.play("landing"); GameSound.playSound(0, 0); } if (OnScreenButtons.start) { // GameSound.playSound(0, 0); MusicPlayer.stop(); GameSound.stopSound(1); } if (OnScreenButtons.buttonA) { // GameSound.resumeSounds(); GameSound.playSound(1, 5); MusicPlayer.play("lucas", true); } if (OnScreenButtons.buttonB) { GameSound.pauseSounds(); setZoomFactor(.5f); } if (OnScreenButtons.buttonX) { GameSound.resumeSounds(); setZoomFactor(1f); } if (OnScreenButtons.buttonY) { GameSound.stopSounds(); setPlayerPositionTolerance(.5f, .5f); } } }