Local game: Introducing PowerUps. Same movement type for keyboard and mobile players

master
EmaMaker 2020-05-18 17:22:13 +02:00
parent 33e0b38608
commit 501a1b1e26
65 changed files with 1207 additions and 338 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -90,14 +90,7 @@ task run(type: Exec) {
} }
dependencies { dependencies {
implementation files('/home/emamaker/github/amazeing/gdx/lib/kryonet-2.21-all.jar') implementation files('/srv/nfs/home/github/amazeing/gdx/lib/kryonet-2.21-all.jar')
<<<<<<< HEAD
} }
=======
implementation files('/home/emamaker/github/amazeing/gdx/lib/kryonet-2.21-all.jar')
}
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
eclipse.project.name = appName + "-android" eclipse.project.name = appName + "-android"

View File

@ -49,18 +49,11 @@ project(":desktop") {
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop" api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion" api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
api "de.tomgrill.gdxdialogs:gdx-dialogs-desktop:1.2.5" api "de.tomgrill.gdxdialogs:gdx-dialogs-desktop:1.2.5"
=======
api "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
} }
} }
@ -84,27 +77,17 @@ project(":android") {
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64" natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
<<<<<<< HEAD
=======
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" api "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion" api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion" api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.2.5" api "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.2.5"
=======
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
} }
} }
@ -122,10 +105,7 @@ project(":ios") {
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios" api "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios"
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
<<<<<<< HEAD
api "de.tomgrill.gdxdialogs:gdx-dialogs-ios:1.2.5" api "de.tomgrill.gdxdialogs:gdx-dialogs-ios:1.2.5"
=======
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
} }
} }
@ -137,19 +117,12 @@ project(":core") {
dependencies { dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion" api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" api "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
<<<<<<< HEAD
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion" api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion" api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4" api "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4"
api "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.2.5" api "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.2.5"
=======
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
>>>>>>> 98d66880a8d39751df9c3f47d8728c913b0851c6
} }
} }

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

View File

@ -2,7 +2,7 @@ apply plugin: "java"
sourceCompatibility = 1.7 sourceCompatibility = 1.7
dependencies { dependencies {
implementation files('/home/emamaker/github/amazeing/gdx/lib/kryonet-2.21-all.jar') implementation files('/srv/nfs/home/github/amazeing/gdx/lib/kryonet-2.21-all.jar')
} }
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

View File

@ -12,6 +12,7 @@ import com.emamaker.amazeing.manager.GameType;
import com.emamaker.amazeing.manager.network.GameClient; import com.emamaker.amazeing.manager.network.GameClient;
import com.emamaker.amazeing.manager.network.GameServer; import com.emamaker.amazeing.manager.network.GameServer;
import com.emamaker.amazeing.maze.settings.MazeSettings; import com.emamaker.amazeing.maze.settings.MazeSettings;
import com.emamaker.amazeing.player.powerups.PowerUps;
import com.emamaker.amazeing.ui.UIManager; import com.emamaker.amazeing.ui.UIManager;
import com.emamaker.voxelengine.VoxelWorld; import com.emamaker.voxelengine.VoxelWorld;
@ -24,7 +25,7 @@ public class AMazeIng extends Game {
Random rand = new Random(); Random rand = new Random();
public UIManager uiManager; public UIManager uiManager;
public GameManager gameManager; public GameManager gameManager, currentGameManager;
public MazeSettings settings; public MazeSettings settings;
public InputMultiplexer multiplexer = new InputMultiplexer(); public InputMultiplexer multiplexer = new InputMultiplexer();
@ -64,6 +65,7 @@ public class AMazeIng extends Game {
generated = false; generated = false;
setupGUI(); setupGUI();
setupGameManager(); setupGameManager();
setupPowerUps();
} }
public void setupGUI() { public void setupGUI() {
@ -81,7 +83,10 @@ public class AMazeIng extends Game {
client = new GameClient(this); client = new GameClient(this);
} }
float delta; public void setupPowerUps() {
System.out.println("Setting up PowerUps");
new PowerUps();
}
@Override @Override
public void render() { public void render() {

View File

@ -14,6 +14,8 @@ import com.emamaker.amazeing.maze.MazeGenerator;
import com.emamaker.amazeing.maze.settings.MazeSettings; import com.emamaker.amazeing.maze.settings.MazeSettings;
import com.emamaker.amazeing.player.MazePlayer; import com.emamaker.amazeing.player.MazePlayer;
import com.emamaker.amazeing.player.MazePlayerLocal; import com.emamaker.amazeing.player.MazePlayerLocal;
import com.emamaker.amazeing.player.powerups.PowerUp;
import com.emamaker.amazeing.player.powerups.PowerUps;
import com.emamaker.amazeing.ui.screens.PreGameScreen; import com.emamaker.amazeing.ui.screens.PreGameScreen;
import com.emamaker.voxelengine.block.CellId; import com.emamaker.voxelengine.block.CellId;
import com.emamaker.voxelengine.player.Player; import com.emamaker.voxelengine.player.Player;
@ -34,6 +36,10 @@ public class GameManager {
GameType type = GameType.LOCAL; GameType type = GameType.LOCAL;
public ArrayList<MazePlayer> players = new ArrayList<MazePlayer>(); public ArrayList<MazePlayer> players = new ArrayList<MazePlayer>();
public ArrayList<PowerUp> powerups = new ArrayList<PowerUp>();
ArrayList<MazePlayer> toDelete = new ArrayList<MazePlayer>();
PowerUp pup;
public GameManager(Game main_, GameType t) { public GameManager(Game main_, GameType t) {
main = (AMazeIng) main_; main = (AMazeIng) main_;
@ -46,8 +52,6 @@ public class GameManager {
stage = new Stage(new ScreenViewport()); stage = new Stage(new ScreenViewport());
} }
ArrayList<MazePlayer> toDelete = new ArrayList<MazePlayer>();
public void generateMaze(Set<MazePlayer> pl, int todraw[][]) { public void generateMaze(Set<MazePlayer> pl, int todraw[][]) {
main.setScreen(null); main.setScreen(null);
@ -55,7 +59,7 @@ public class GameManager {
anyoneWon = false; anyoneWon = false;
if(AMazeIng.PLATFORM == Platform.DESKTOP) { if (AMazeIng.PLATFORM == Platform.DESKTOP) {
if (pl != null) { if (pl != null) {
for (MazePlayer p : players) for (MazePlayer p : players)
if (!pl.contains(p)) if (!pl.contains(p))
@ -74,15 +78,13 @@ public class GameManager {
} }
toDelete.clear(); toDelete.clear();
} }
}else{ } else {
for (MazePlayer p : players) { for (MazePlayer p : players)
p.dispose(); p.dispose();
}
players.clear(); players.clear();
players.addAll(pl); players.addAll(pl);
} }
for (int i = 0; i < MazeSettings.MAZEX; i++) { for (int i = 0; i < MazeSettings.MAZEX; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
for (int k = 0; k < MazeSettings.MAZEZ; k++) { for (int k = 0; k < MazeSettings.MAZEZ; k++) {
@ -97,6 +99,8 @@ public class GameManager {
if (type != GameType.CLIENT) { if (type != GameType.CLIENT) {
spreadPlayers(); spreadPlayers();
mazeGen.setupEndPoint(); mazeGen.setupEndPoint();
powerups.clear();
spawnPowerUps();
} }
if (todraw != null && showGame == true) { if (todraw != null && showGame == true) {
@ -112,14 +116,17 @@ public class GameManager {
for (MazePlayer p : players) { for (MazePlayer p : players) {
if (p instanceof MazePlayerLocal) if (p instanceof MazePlayerLocal)
stage.addActor(((MazePlayerLocal) p).tctrl); stage.addActor(((MazePlayerLocal) p).tctrl);
stage.addActor(((MazePlayerLocal) p).touchpadPowerUp);
} }
AMazeIng.getMain().multiplexer.addProcessor(stage); AMazeIng.getMain().multiplexer.addProcessor(stage);
} }
public void update() { public void update() {
main.currentGameManager = this;
if (gameStarted && !anyoneWon) { if (gameStarted && !anyoneWon) {
pup = null;
if (getShowGame()) { if (getShowGame()) {
main.world.render(); main.world.render();
@ -133,10 +140,27 @@ public class GameManager {
} }
main.world.modelBatch.begin(main.world.cam); main.world.modelBatch.begin(main.world.cam);
if (getShowGame())
for (PowerUp p : powerups)
p.render(main.world.modelBatch, main.world.environment);
if (players != null) { if (players != null) {
for (MazePlayer p : players) { for (MazePlayer p : players) {
if (getShowGame() && !p.isDisposed()) if (!p.isDisposed()) {
// Check if there's a power-up in the same spot, if so give it to the player
for (PowerUp p1 : powerups)
if ((int) p1.getPosition().x == (int) p.getPos().x
&& (int) p1.getPosition().z == (int) p.getPos().z) {
pup = p1;
p.currentPowerUp = pup;
break;
}
if (pup != null)
powerups.remove(pup);
if (getShowGame())
p.render(main.world.modelBatch, main.world.environment); p.render(main.world.modelBatch, main.world.environment);
}
anyoneWon = false; anyoneWon = false;
if (type != GameType.CLIENT) { if (type != GameType.CLIENT) {
@ -161,7 +185,6 @@ public class GameManager {
} }
main.world.modelBatch.end(); main.world.modelBatch.end();
} }
} }
@ -177,6 +200,21 @@ public class GameManager {
p.setPlaying(); p.setPlaying();
p.setPos(x + 0.5f, 2f, z + 0.5f); p.setPos(x + 0.5f, 2f, z + 0.5f);
} }
}
public void spawnPowerUps() {
for (int i = 0; i < MazeSettings.START_POWERUPS; i++) {
PowerUp p = PowerUps.pickRandomPU();
int x = 1, z = 1;
do {
x = (Math.abs(rand.nextInt() - 1) % (mazeGen.w));
z = (Math.abs(rand.nextInt() - 1) % (mazeGen.h));
} while (thereIsPlayerInPos(x, z) || mazeGen.occupiedSpot(x, z) || thereIsPowerUpInPos(x, z));
p.setPosition(x + 0.5f, 1.25f, z + 0.5f);
powerups.add(p);
System.out.println("Spawning power-up in " + x + ", " + z);
}
} }
@ -212,6 +250,14 @@ public class GameManager {
return false; return false;
} }
public boolean thereIsPowerUpInPos(int x, int z) {
for (PowerUp p : powerups) {
if ((int) p.getPosition().x == x || (int) p.getPosition().z == z)
return true;
}
return false;
}
public boolean areTherePlayersNearby(int x, int z, int range) { public boolean areTherePlayersNearby(int x, int z, int range) {
int i, k; int i, k;
for (MazePlayer p : players) { for (MazePlayer p : players) {
@ -221,10 +267,17 @@ public class GameManager {
if ((x - i) * (x - i) + (k - z) * (k - z) <= range * range) if ((x - i) * (x - i) + (k - z) * (k - z) <= range * range)
return true; return true;
} }
return false; return false;
} }
public MazePlayer getRandomPlayer() {
return players.get(Math.abs(rand.nextInt() % players.size()));
}
public void requestChangeToMap(int[][] todraw) {
mazeGen.requestChangeToMap(todraw);
}
public void resetCamera() { public void resetCamera() {
main.world.cam.position.set(0f, 0f, 0.5f); // Set cam position at origin main.world.cam.position.set(0f, 0f, 0.5f); // Set cam position at origin
main.world.cam.lookAt(0, 0, 0); // Direction to look at, for setting direction (perhaps better to set manually) main.world.cam.lookAt(0, 0, 0); // Direction to look at, for setting direction (perhaps better to set manually)

View File

@ -5,8 +5,6 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Hashtable; import java.util.Hashtable;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.Quaternion; import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad; import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
@ -240,29 +238,26 @@ public class GameClient {
// Consantly search for new players to be added // Consantly search for new players to be added
if(AMazeIng.PLATFORM == AMazeIng.Platform.DESKTOP) { if(AMazeIng.PLATFORM == AMazeIng.Platform.DESKTOP) {
// Search for keyboard players (WASD and ARROWS) on Desktop // Search for keyboard players (WASD and ARROWS) on Desktop
if (Gdx.input.isKeyJustPressed(Keys.W) || Gdx.input.isKeyJustPressed(Keys.A) if (PlayerUtils.wasdPressed()) {
|| Gdx.input.isKeyJustPressed(Keys.S) || Gdx.input.isKeyJustPressed(Keys.D)) { p = PlayerUtils.getPlayerWithKeys(new HashSet<>(players.values()), PlayerUtils.WASDKEYS);
p = PlayerUtils.getPlayerWithKeys(new HashSet<>(players.values()), Keys.W, Keys.S, Keys.A, Keys.D);
if (p != null) { if (p != null) {
RemovePlayer msg = new RemovePlayer(); RemovePlayer msg = new RemovePlayer();
msg.uuid = p.uuid; msg.uuid = p.uuid;
client.sendTCP(msg); client.sendTCP(msg);
} else { } else {
localPlrQueue.add(new MazePlayerLocal(Keys.W, Keys.S, Keys.A, Keys.D)); localPlrQueue.add(new MazePlayerLocal(PlayerUtils.WASDKEYS));
client.sendTCP(new LoginAO()); client.sendTCP(new LoginAO());
} }
} }
if (Gdx.input.isKeyJustPressed(Keys.UP) || Gdx.input.isKeyJustPressed(Keys.LEFT) if (PlayerUtils.arrowsPressed()) {
|| Gdx.input.isKeyJustPressed(Keys.DOWN) || Gdx.input.isKeyJustPressed(Keys.RIGHT)) { p = PlayerUtils.getPlayerWithKeys(new HashSet<>(players.values()), PlayerUtils.ARROWKEYS);
p = PlayerUtils.getPlayerWithKeys(new HashSet<>(players.values()), Keys.UP, Keys.DOWN, Keys.LEFT,
Keys.RIGHT);
if (p != null) { if (p != null) {
RemovePlayer msg = new RemovePlayer(); RemovePlayer msg = new RemovePlayer();
msg.uuid = p.uuid; msg.uuid = p.uuid;
client.sendTCP(msg); client.sendTCP(msg);
} else { } else {
localPlrQueue.add(new MazePlayerLocal(Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT)); localPlrQueue.add(new MazePlayerLocal( PlayerUtils.ARROWKEYS));
client.sendTCP(new LoginAO()); client.sendTCP(new LoginAO());
} }
} }
@ -312,6 +307,10 @@ public class GameClient {
} }
} }
public void requestUpdateMap(int[][] tmpMap) {
}
public void setUpdateMobilePlayers(){ public void setUpdateMobilePlayers(){
updateMobilePlayers = true; updateMobilePlayers = true;
} }

View File

@ -15,9 +15,9 @@ public class MazeGenerator {
Cell currentCell; Cell currentCell;
Cell[][] cellsGrid; Cell[][] cellsGrid;
ArrayList<Cell> stack = new ArrayList<Cell>(); ArrayList<Cell> stack = new ArrayList<Cell>();
public int[][] todraw; public static int[][] todraw;
public int w, h, W, H; public static int w, h, W, H;
public int WINX = Integer.MAX_VALUE, WINZ = Integer.MAX_VALUE; public int WINX = Integer.MAX_VALUE, WINZ = Integer.MAX_VALUE;
public int OLDMAZEX, OLDMAZEZ; public int OLDMAZEX, OLDMAZEZ;
@ -234,8 +234,8 @@ public class MazeGenerator {
public void show(int[][] todraw_) { public void show(int[][] todraw_) {
for (int j = 0; j < OLDMAZEX+2; j++) { for (int j = 0; j < OLDMAZEX + 2; j++) {
for (int i = 0; i < OLDMAZEZ+2; i++) { for (int i = 0; i < OLDMAZEZ + 2; i++) {
main.world.worldManager.setCell(i, 0, j, CellId.ID_AIR); main.world.worldManager.setCell(i, 0, j, CellId.ID_AIR);
main.world.worldManager.setCell(i, 1, j, CellId.ID_AIR); main.world.worldManager.setCell(i, 1, j, CellId.ID_AIR);
} }
@ -261,6 +261,19 @@ public class MazeGenerator {
} }
} }
public static int[][] changeMap(int[][] tmp, int x, int z, int type) {
if(x > 0 && x < w - 1 && z > 0 && z < h - 1 && todraw[x][z] != 2) tmp[x][z] = type;
return tmp;
}
public void requestChangeToMap(int[][] todraw_) {
if(AMazeIng.getMain().client.isRunning()) {
AMazeIng.getMain().client.requestUpdateMap(todraw_);
}else {
show(todraw_);
}
}
boolean allCellsVisited() { boolean allCellsVisited() {
for (int i = 0; i < W; i++) { for (int i = 0; i < W; i++) {
for (int j = 0; j < H; j++) { for (int j = 0; j < H; j++) {

View File

@ -43,6 +43,15 @@ public class MazeSetting {
setOptions(options_, defaultOption); setOptions(options_, defaultOption);
update(); update();
//Build the Table which will be later used to add this to the screen
table = new Table();
nameLabel = new Label(this.name, uiManager.skin);
currentOptLabel = new Label(this.options[currentOption], uiManager.skin);
backBtn = new TextButton("<", uiManager.skin);
forthBtn = new TextButton(">", uiManager.skin);
resetBtn = new TextButton("R", uiManager.skin);
// Add actions to the buttons // Add actions to the buttons
backBtn.addListener(new InputListener() { backBtn.addListener(new InputListener() {
@Override @Override

View File

@ -0,0 +1,21 @@
package com.emamaker.amazeing.maze.settings;
import com.emamaker.amazeing.ui.UIManager;
public class MazeSettingStartPowerUps extends MazeSetting{
/* Game max. number of players settings*/
public MazeSettingStartPowerUps(String name_, String[] options_, UIManager uiManager_) {
super(name_, options_, uiManager_);
}
public MazeSettingStartPowerUps(String name_, String[] options_, int defaultOption, UIManager uiManager_) {
super(name_, options_, defaultOption, uiManager_);
}
@Override
public void parseOptionString(String opt) {
MazeSettings.START_POWERUPS = Integer.valueOf(opt);
}
}

View File

@ -6,53 +6,60 @@ import com.emamaker.amazeing.AMazeIng;
public class MazeSettings { public class MazeSettings {
//This must only hold public static variables to eventually their getters and setters // This must only hold public static variables to eventually their getters and
// setters
public static int MAZEX = 20; public static int MAZEX = 20;
public static int MAZEZ = 20; public static int MAZEZ = 20;
public static int MAXPLAYERS = 8; public static int MAXPLAYERS = 8;
public static int MAXPLAYERS_MOBILE = 1; public static int MAXPLAYERS_MOBILE = 1;
public static int EPDIST = 5; public static int EPDIST = 5;
public static int START_POWERUPS = 3;
public static ArrayList<MazeSetting> settings = new ArrayList<MazeSetting>(); public static ArrayList<MazeSetting> settings = new ArrayList<MazeSetting>();
public static MazeSetting setDim; public static MazeSetting setDim;
public static MazeSetting setPlayers; public static MazeSetting setPlayers;
public static MazeSetting setPlayers_Mobile; public static MazeSetting setPlayers_Mobile;
public static MazeSetting setEpDist; public static MazeSetting setEpDist;
public static MazeSetting setStartPowerups;
public static String[] maxPlayersDesktop = new String[] { public static String[] maxPlayersDesktop = new String[] { "2", "4", "6", "8", "10", "15", "20" };
"2", "4", "6", "8", "10", "15", "20" public static String[] maxPlayersMobile = new String[] { "1", "2", "3", "4" };
};
public static String[] maxPlayersMobile = new String[] {
"1", "2", "3", "4"
};
public MazeSettings() { public MazeSettings() {
//Add various settings here // Add various settings here
setDim = new MazeSettingDimension("MAZE DIMENSIONS:", new String[] { setDim = new MazeSettingDimension("MAZE DIMENSIONS:", new String[] { "10x10", "20x20", "30x30" }, 1,
"10x10", "20x20", "30x30" AMazeIng.getMain().uiManager);
}, 1, AMazeIng.getMain().uiManager);
setPlayers = new MazeSettingMaxPlayers("MAX NUMBER OF PLAYERS: ", maxPlayersDesktop, AMazeIng.getMain().uiManager); setPlayers = new MazeSettingMaxPlayers("MAX NUMBER OF PLAYERS: ", maxPlayersDesktop,
setPlayers_Mobile = new MazeSettingMaxPlayersMobile("PLAYERS JOINING FROM THIS DEVICE: ", maxPlayersMobile, 0, AMazeIng.getMain().uiManager); AMazeIng.getMain().uiManager);
setPlayers_Mobile = new MazeSettingMaxPlayersMobile("PLAYERS JOINING FROM THIS DEVICE: ", maxPlayersMobile, 0,
AMazeIng.getMain().uiManager);
setEpDist = new MazeSettingEPDIST("END POINT DISTANCE:", new String[] { setStartPowerups = new MazeSettingStartPowerUps("POWERUPS AT START : ",
"1", "2", "5", "10", "20" new String[] { "1", "2", "3", "4", "5", "8", "10", "15" }, 3, AMazeIng.getMain().uiManager);
}, 2, AMazeIng.getMain().uiManager);
setEpDist = new MazeSettingEPDIST("END POINT DISTANCE:", new String[] { "1", "2", "5", "10", "20" }, 2,
AMazeIng.getMain().uiManager);
settings.add(setDim); settings.add(setDim);
settings.add(setPlayers); settings.add(setPlayers);
settings.add(setEpDist); settings.add(setEpDist);
settings.add(setStartPowerups);
} }
public static void saveStates() { public static void saveStates() {
for(MazeSetting m : settings) m.saveState(); for (MazeSetting m : settings)
} m.saveState();
public static void restoreStates() {
for(MazeSetting m : settings) m.saveState();
}
public static void resetAll() {
for(MazeSetting m : settings) m.reset();
} }
public static void restoreStates() {
for (MazeSetting m : settings)
m.saveState();
}
public static void resetAll() {
for (MazeSetting m : settings)
m.reset();
}
} }

View File

@ -16,6 +16,7 @@ import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.Disposable;
import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.player.powerups.PowerUp;
import com.emamaker.voxelengine.physics.GameObject; import com.emamaker.voxelengine.physics.GameObject;
public abstract class MazePlayer implements Disposable { public abstract class MazePlayer implements Disposable {
@ -37,6 +38,13 @@ public abstract class MazePlayer implements Disposable {
boolean playing = false; boolean playing = false;
boolean show = true; boolean show = true;
public String uuid; public String uuid;
public PowerUp currentPowerUp;
public float baseSpeed = 3f;
public float baseTurnSpeed = 2.5f;
public float speedMult = 1f;
public float speed;
public float turnSpeed;
Vector3 pos = new Vector3(); Vector3 pos = new Vector3();
Quaternion rot = new Quaternion(); Quaternion rot = new Quaternion();
@ -115,6 +123,16 @@ public abstract class MazePlayer implements Disposable {
} }
public void update() { public void update() {
speed = baseSpeed * speedMult;
turnSpeed = baseTurnSpeed * speedMult;
if(currentPowerUp != null && currentPowerUp.continousEffect) usePowerUp();
}
public void usePowerUp() {
if (currentPowerUp != null && !currentPowerUp.beingUsed)
if (currentPowerUp.usePowerUp(this))
currentPowerUp = null;
} }
@Override @Override

View File

@ -14,6 +14,7 @@ import com.badlogic.gdx.physics.bullet.dynamics.btDiscreteDynamicsWorld;
import com.badlogic.gdx.physics.bullet.dynamics.btKinematicCharacterController; import com.badlogic.gdx.physics.bullet.dynamics.btKinematicCharacterController;
import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad; import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.AMazeIng;
@ -35,36 +36,38 @@ public class MazePlayerLocal extends MazePlayer {
public int tctrlPosition; public int tctrlPosition;
boolean touchpadPressed = false; boolean touchpadPressed = false;
public TextButton touchpadPowerUp;
float oldAngle = 0, angle; float oldAngle = 0, angle;
// Physics using LibGDX's bullet wrapper // Physics using LibGDX's bullet wrapper
public int kup, kdown, ksx, kdx; public int kup, kdown, ksx, kdx, kpup;
float startx, starty, startz; float startx, starty, startz;
// Give keys in up, down, left, right order // Give keys in up, down, left, right order
public MazePlayerLocal(int... keys) { public MazePlayerLocal(int... keys) {
this(keys[0], keys[1], keys[2], keys[3]); this(keys[0], keys[1], keys[2], keys[3], keys[4]);
} }
public MazePlayerLocal(int up_, int down_, int sx_, int dx_) { public MazePlayerLocal(int up_, int down_, int sx_, int dx_, int pup_) {
this(up_, down_, sx_, dx_, 0, 0, 0); this(up_, down_, sx_, dx_, pup_, 0, 0, 0);
} }
public MazePlayerLocal(int up_, int down_, int sx_, int dx_, String name) { public MazePlayerLocal(int up_, int down_, int sx_, int dx_, int pup_, String name) {
this(up_, down_, sx_, dx_, 0, 0, 0, name); this(up_, down_, sx_, dx_, pup_, 0, 0, 0, name);
} }
public MazePlayerLocal(int up_, int down_, int sx_, int dx_, float startx, float starty, float startz) { public MazePlayerLocal(int up_, int down_, int sx_, int dx_, int pup_, float startx, float starty, float startz) {
this(up_, down_, sx_, dx_, startx, starty, startz, String.valueOf((char) (65 + rand.nextInt(26)))); this(up_, down_, sx_, dx_, pup_, startx, starty, startz, String.valueOf((char) (65 + rand.nextInt(26))));
} }
public MazePlayerLocal(int up_, int down_, int sx_, int dx_, float startx, float starty, float startz, public MazePlayerLocal(int up_, int down_, int sx_, int dx_, int pup_, float startx, float starty, float startz,
String name) { String name) {
super(name, true); super(name, true);
this.kup = up_; this.kup = up_;
this.kdown = down_; this.kdown = down_;
this.ksx = sx_; this.ksx = sx_;
this.kdx = dx_; this.kdx = dx_;
this.kpup = pup_;
this.startx = startx; this.startx = startx;
this.starty = starty; this.starty = starty;
@ -123,10 +126,12 @@ public class MazePlayerLocal extends MazePlayer {
angle = 0; angle = 0;
touchpadPressed = false; touchpadPressed = false;
touchpadPowerUp = new TextButton("No object to use", AMazeIng.getMain().uiManager.skin);
tctrl.setSize(Gdx.graphics.getHeight() / 6f, Gdx.graphics.getHeight() / 6f); tctrl.setSize(Gdx.graphics.getHeight() / 6f, Gdx.graphics.getHeight() / 6f);
touchpadPowerUp.setSize(Gdx.graphics.getHeight() / 6f, Gdx.graphics.getHeight() / 12f);
tctrl.addListener(new InputListener() { tctrl.addListener(new InputListener() {
@Override @Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
return true; return true;
@ -138,7 +143,7 @@ public class MazePlayerLocal extends MazePlayer {
angle = MathUtils.atan2(-tctrl.getKnobPercentY(), -tctrl.getKnobPercentX()) * 180f / MathUtils.PI; angle = MathUtils.atan2(-tctrl.getKnobPercentY(), -tctrl.getKnobPercentX()) * 180f / MathUtils.PI;
touchpadPressed = true; touchpadPressed = true;
//System.out.println(angle); // System.out.println(angle);
} }
@Override @Override
@ -147,19 +152,32 @@ public class MazePlayerLocal extends MazePlayer {
} }
}); });
if (tctrlPosition == 0) touchpadPowerUp.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
usePowerUp();
return true;
}
});
if (tctrlPosition == 0) {
tctrl.setPosition(tctrl.getWidth() / 2, tctrl.getHeight() / 2); tctrl.setPosition(tctrl.getWidth() / 2, tctrl.getHeight() / 2);
else if (tctrlPosition == 1) touchpadPowerUp.setPosition(tctrl.getWidth() / 2, tctrl.getHeight() * 1.75f);
} else if (tctrlPosition == 1) {
tctrl.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f, tctrl.getHeight() / 2); tctrl.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f, tctrl.getHeight() / 2);
else if (tctrlPosition == 2) touchpadPowerUp.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f, tctrl.getHeight() * 1.75f);
tctrl.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f, Gdx.graphics.getHeight() - tctrl.getHeight() * 1.5f); } else if (tctrlPosition == 2) {
else if (tctrlPosition == 3) tctrl.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f,
Gdx.graphics.getHeight() - tctrl.getHeight() * 1.5f);
touchpadPowerUp.setPosition(Gdx.graphics.getWidth() - tctrl.getWidth() * 1.5f, Gdx.graphics.getHeight() - tctrl.getHeight() *2.25f);
} else if (tctrlPosition == 3) {
tctrl.setPosition(tctrl.getWidth() / 2, Gdx.graphics.getHeight() - tctrl.getHeight() * 1.5f); tctrl.setPosition(tctrl.getWidth() / 2, Gdx.graphics.getHeight() - tctrl.getHeight() * 1.5f);
touchpadPowerUp.setPosition(tctrl.getWidth() / 2, Gdx.graphics.getHeight() - tctrl.getHeight() * 2.25f);
}
initPhysics(); initPhysics();
} }
public void initPhysics() { public void initPhysics() {
characterTransform = instance.transform; // Set by reference characterTransform = instance.transform; // Set by reference
characterTransform.set(startx, starty, startz, 0, 0, 0, 0); characterTransform.set(startx, starty, startz, 0, 0, 0, 0);
@ -167,7 +185,7 @@ public class MazePlayerLocal extends MazePlayer {
// Create the physics representation of the character // Create the physics representation of the character
ghostObject = new btPairCachingGhostObject(); ghostObject = new btPairCachingGhostObject();
ghostObject.setWorldTransform(characterTransform); ghostObject.setWorldTransform(characterTransform);
ghostShape = new btBoxShape(new Vector3(0.3f, 0.3f, 0.3f)); ghostShape = new btBoxShape(new Vector3(0.3f, 0.5f, 0.3f));
ghostObject.setCollisionShape(ghostShape); ghostObject.setCollisionShape(ghostShape);
ghostObject.setCollisionFlags(btCollisionObject.CollisionFlags.CF_CHARACTER_OBJECT); ghostObject.setCollisionFlags(btCollisionObject.CollisionFlags.CF_CHARACTER_OBJECT);
characterController = new btKinematicCharacterController(ghostObject, ghostShape, .05f, Vector3.Y); characterController = new btKinematicCharacterController(ghostObject, ghostShape, .05f, Vector3.Y);
@ -183,62 +201,67 @@ public class MazePlayerLocal extends MazePlayer {
boolean pressed = false; boolean pressed = false;
public void inputs() { public void inputs() {
//Update for touchscreen controller is done in touchpad listener
if(AMazeIng.PLATFORM == AMazeIng.Platform.DESKTOP){
if (ctrl != null) {
}else{
pressed = false; pressed = false;
// If the left or right key is pressed, rotate the character and update its // Update for touchscreen controller is done in touchpad listener
// physics update accordingly. if (AMazeIng.PLATFORM == AMazeIng.Platform.DESKTOP)
if (Gdx.input.isKeyPressed(ksx)) { if (ctrl != null)
pressed = true; inputController();
characterTransform.rotate(0, 1, 0, 2.5f); else
ghostObject.setWorldTransform(characterTransform); inputKeyboard();
else
inputTouchscreen();
if (pressed)
main.client.updateLocalPlayer(this);
} }
if (Gdx.input.isKeyPressed(kdx)) {
pressed = true; public void inputController() {
characterTransform.rotate(0, 1, 0, -2.5f);
ghostObject.setWorldTransform(characterTransform);
} }
// Fetch which direction the character is facing now
characterDirection.set(-1, 0, 0).rot(characterTransform).nor(); public void inputKeyboard() {
// Set the walking direction accordingly (either forward or backward) if (Gdx.input.isKeyPressed(kdown))
characterDirection.set(-1, 0, 0).rotate(90, 0, 1, 0).nor();
if (Gdx.input.isKeyPressed(kup))
characterDirection.set(-1, 0, 0).rotate(-90, 0, 1, 0).nor();
if (Gdx.input.isKeyPressed(ksx))
characterDirection.set(-1, 0, 0).rotate(0, 0, 1, 0).nor();
if (Gdx.input.isKeyPressed(kdx))
characterDirection.set(-1, 0, 0).rotate(180, 0, 1, 0).nor();
if (Gdx.input.isKeyPressed(kdown) || Gdx.input.isKeyPressed(kup) || Gdx.input.isKeyPressed(ksx)
|| Gdx.input.isKeyPressed(kdx)) {
walkDirection.set(0, 0, 0); walkDirection.set(0, 0, 0);
if (Gdx.input.isKeyPressed(kup)) {
pressed = true;
walkDirection.add(characterDirection); walkDirection.add(characterDirection);
} walkDirection.scl(speed * Gdx.graphics.getDeltaTime());
if (Gdx.input.isKeyPressed(kdown)) {
pressed = false;
walkDirection.add(-characterDirection.x, -characterDirection.y, -characterDirection.z);
}
walkDirection.scl(3f * Gdx.graphics.getDeltaTime());
// And update the character controller
characterController.setWalkDirection(walkDirection); characterController.setWalkDirection(walkDirection);
// Now we can update the world as normally
// And fetch the new transformation of the character (this will make the model
// be rendered correctly)
ghostObject.getWorldTransform(characterTransform); ghostObject.getWorldTransform(characterTransform);
}
}else{
if(touchpadPressed) {
//characterTransform.rotate(0, 1, 0, angle-oldAngle); pressed = true;
//ghostObject.setWorldTransform(characterTransform); } else {
walkDirection.set(0, 0, 0);
characterController.setWalkDirection(walkDirection);
}
if (Gdx.input.isKeyJustPressed(kpup))
usePowerUp();
}
public void inputTouchscreen() {
if (touchpadPressed) {
touchpadPowerUp.setText("No object to use");
if(currentPowerUp != null) touchpadPowerUp.setText(currentPowerUp.name.toUpperCase() + "!");
// characterTransform.rotate(0, 1, 0, angle-oldAngle);
// ghostObject.setWorldTransform(characterTransform);
// Fetch which direction the character is facing now // Fetch which direction the character is facing now
characterDirection.set(-1, 0, 0).rotate(angle, 0, 1, 0).nor(); characterDirection.set(-1, 0, 0).rotate(angle, 0, 1, 0).nor();
// characterDirection.set(-1, 0, 0).rot(characterTransform).nor(); // characterDirection.set(-1, 0, 0).rot(characterTransform).nor();
// Set the walking direction accordingly (either forward or backward) // Set the walking direction accordingly (either forward or backward)
walkDirection.set(0, 0, 0); walkDirection.set(0, 0, 0);
walkDirection.add(characterDirection); walkDirection.add(characterDirection);
walkDirection.scl(3f * Gdx.graphics.getDeltaTime()); walkDirection.scl(speed * Gdx.graphics.getDeltaTime());
// And update the character controller // And update the character controller
characterController.setWalkDirection(walkDirection); characterController.setWalkDirection(walkDirection);
// Now we can update the world as normally // Now we can update the world as normally
@ -248,16 +271,15 @@ public class MazePlayerLocal extends MazePlayer {
oldAngle = angle; oldAngle = angle;
pressed = true; pressed = true;
} else {
walkDirection.set(0, 0, 0);
characterController.setWalkDirection(walkDirection);
} }
} }
if (pressed)
main.client.updateLocalPlayer(this);
}
@Override @Override
public void update() { public void update() {
super.update();
inputs(); inputs();
} }

View File

@ -4,11 +4,28 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.controllers.Controller; import com.badlogic.gdx.controllers.Controller;
import com.emamaker.amazeing.maze.settings.MazeSettings; import com.emamaker.amazeing.maze.settings.MazeSettings;
public class PlayerUtils { public class PlayerUtils {
public static int[] WASDKEYS = {Keys.W, Keys.S, Keys.A, Keys.D, Keys.SPACE};
public static int[] ARROWKEYS = {Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT, Keys.SHIFT_RIGHT};
public static boolean wasdPressed() {
for(int i : WASDKEYS)
if(Gdx.input.isKeyJustPressed(i)) return true;
return false;
}
public static boolean arrowsPressed() {
for(int i : ARROWKEYS)
if(Gdx.input.isKeyJustPressed(i)) return true;
return false;
}
/*Utility function to add and remove players from arrays when organizing as game*/ /*Utility function to add and remove players from arrays when organizing as game*/
public static boolean togglePlayer(MazePlayerLocal p, Set<MazePlayer> players) { public static boolean togglePlayer(MazePlayerLocal p, Set<MazePlayer> players) {

View File

@ -0,0 +1,172 @@
package com.emamaker.amazeing.player.powerups;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
import com.badlogic.gdx.graphics.g3d.model.Node;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.math.Vector3;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.player.MazePlayer;
public class PowerUp {
public String name;
Texture texture;
public boolean beingUsed, continousEffect;
ModelBuilder modelBuilder = new ModelBuilder();
ModelInstance instance;
Model quadModel;
static int meshAttr = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
| VertexAttributes.Usage.TextureCoordinates;
BlendingAttribute blendingAttribute = new BlendingAttribute();
float scaleX, scaleZ;
public PowerUp(String name_, Texture texture_, boolean cont) {
this(name_, texture_, cont, 1, 1);
}
public PowerUp(String name_, Texture texture_, boolean cont, float scaleX, float scaleZ) {
this.name = name_;
this.texture = texture_;
this.scaleX = scaleX;
this.scaleZ = scaleZ;
this.continousEffect = cont;
blendingAttribute.blended = true;
blendingAttribute.sourceFunction = GL20.GL_SRC_ALPHA;
blendingAttribute.destFunction = GL20.GL_ONE_MINUS_SRC_ALPHA;
beingUsed = false;
spawnQuad();
setPosition(0, 3, 0);
}
@SuppressWarnings("deprecation")
public void spawnQuad() {
modelBuilder.begin();
Node n = modelBuilder.node();
n.id = "Quad";
modelBuilder
.part("Quad", GL20.GL_TRIANGLES, meshAttr,
new Material(TextureAttribute.createDiffuse(texture), blendingAttribute))
.box(0.85f * scaleX, 0.000001f, 0.85f * scaleZ);
n.rotation.set(Vector3.Y, 90);
quadModel = modelBuilder.end();
instance = new ModelInstance(quadModel);
}
protected void setModelScale(float x, float y) {
instance.transform.scale(scaleX, 1, scaleZ);
}
public void render(ModelBatch b, Environment e) {
b.render(instance, e);
}
public void setPosition(float x, float y, float z) {
instance.transform.set(x, y, z, 0, 0, 0, 0);
}
public void setPosition(Vector3 v) {
this.setPosition(v.x, v.y, v.z);
}
public Vector3 getPosition() {
return instance.transform.getTranslation(new Vector3());
}
// Return true if the effect has been resolved
public boolean usePowerUp(MazePlayer player) {
// System.out.println(this.name + "!");
return true;
}
}
class PowerUpTemporized extends PowerUp {
long time = 0, startTime = 0;
boolean used = false;
public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_) {
this(name_, texture_, cont, secs_, 1, 1);
}
public PowerUpTemporized(String name_, Texture texture_, boolean cont, float secs_, float scaleX, float scaleZ) {
super(name_, texture_, cont, scaleX, scaleZ);
this.time = (long) (secs_*1000);
startTime = 0;
}
@Override
public boolean usePowerUp(MazePlayer player) {
super.usePowerUp(player);
if (!used) {
startTime = System.currentTimeMillis();
used = true;
}
if (System.currentTimeMillis() - startTime < time) {
temporizedEffect(player);
return false;
} else {
used = false;
temporizedEffectExpired(player);
return true;
}
}
public void temporizedEffect(MazePlayer player) {
}
public void temporizedEffectExpired(MazePlayer player) {
}
}
class PowerUpGiver extends PowerUp {
PowerUp powerup;
MazePlayer p;
public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos) {
this(p, name, texture, continuos, 1f, 1f);
}
public PowerUpGiver(PowerUp p, String name, Texture texture, boolean continuos, float scaleX, float scaleZ) {
super(name, texture, continuos, scaleX, scaleZ);
this.powerup = p;
}
@Override
public boolean usePowerUp(MazePlayer player) {
super.usePowerUp(player);
p = null;
if (AMazeIng.getMain().currentGameManager.players.size() > 1) {
while (p == player || p == null)
p = AMazeIng.getMain().currentGameManager.getRandomPlayer();
p.currentPowerUp = new PowerUpBallAndChain();
p.usePowerUp();
}
return true;
}
}

View File

@ -0,0 +1,34 @@
package com.emamaker.amazeing.player.powerups;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.emamaker.amazeing.player.MazePlayer;
public class PowerUpBallAndChain extends PowerUpTemporized {
public PowerUpBallAndChain() {
super("BALL AND CHAIN",
new Texture(Gdx.files.internal("data/powerups/ball_and_chain.png")), true,
10, 1f, 1f);
}
@Override
public void temporizedEffect(MazePlayer player) {
player.speedMult = 0.5f;
}
@Override
public void temporizedEffectExpired(MazePlayer player) {
player.speedMult = 1f;
}
}
class PowerUpGiveBallAndChain extends PowerUpGiver {
public PowerUpGiveBallAndChain() {
super(new PowerUpBallAndChain(), "BALL AND CHAIN GIVER",
new Texture(Gdx.files.internal("data/powerups/ball_and_chain.png")), false,
1f, 1f);
}
}

View File

@ -0,0 +1,53 @@
package com.emamaker.amazeing.player.powerups;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.emamaker.amazeing.AMazeIng;
import com.emamaker.amazeing.maze.MazeGenerator;
import com.emamaker.amazeing.player.MazePlayer;
public class PowerUpBomb extends PowerUp {
int radius = 1;
public PowerUpBomb() {
this("BOMB", new Texture(Gdx.files.internal("data/powerups/bomb.png")), false, 1f, 1f);
}
public PowerUpBomb(String name, Texture texture, boolean cont, float sx, float sz) {
super(name, texture, cont, sx, sz);
}
@Override
public boolean usePowerUp(MazePlayer player) {
super.usePowerUp(player);
int px = (int) player.getPos().x;
int pz = (int) player.getPos().z;
int tmptodraw[][] = new int[MazeGenerator.w][MazeGenerator.h];
for (int i = 0; i < MazeGenerator.w; i++)
for (int k = 0; k < MazeGenerator.h; k++)
tmptodraw[i][k] = MazeGenerator.todraw[i][k];
for (int i = px - radius; i < px + radius + 1; i++) {
for (int k = pz - radius; k < pz + radius + 1; k++) {
tmptodraw = MazeGenerator.changeMap(tmptodraw, i, k, 0);
}
}
AMazeIng.getMain().currentGameManager.requestChangeToMap(tmptodraw);
return true;
}
}
class PowerUpBigBomb extends PowerUpBomb{
public PowerUpBigBomb() {
super("BIG BOMB", new Texture(Gdx.files.internal("data/powerups/bomb.png")), false, 1.5f, 1.5f);
radius = 2;
}
}

View File

@ -0,0 +1,24 @@
package com.emamaker.amazeing.player.powerups;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.emamaker.amazeing.player.MazePlayer;
public class PowerUpFeather extends PowerUpTemporized {
public PowerUpFeather() {
super("FEATHER", new Texture(Gdx.files.internal("data/powerups/feather.png")), true, 10,
1f, 1f);
}
@Override
public void temporizedEffect(MazePlayer player) {
player.speedMult = 2f;
}
@Override
public void temporizedEffectExpired(MazePlayer player) {
player.speedMult = 1f;
}
}

View File

@ -0,0 +1,33 @@
package com.emamaker.amazeing.player.powerups;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.emamaker.amazeing.player.MazePlayer;
public class PowerUpSlug extends PowerUpTemporized {
public PowerUpSlug() {
super("SLUG", new Texture(Gdx.files.internal("data/powerups/slug.png")), true, 20,
1.3f, 1.3f);
}
@Override
public void temporizedEffect(MazePlayer player) {
player.speedMult = 0.25f;
}
@Override
public void temporizedEffectExpired(MazePlayer player) {
player.speedMult = 1f;
}
}
class PowerUpGiveSlug extends PowerUpGiver {
public PowerUpGiveSlug() {
super(new PowerUpSlug(), "SLUG GIVER",
new Texture(Gdx.files.internal("data/powerups/slug.png")), false, 1f, 1f);
}
}

View File

@ -0,0 +1,41 @@
package com.emamaker.amazeing.player.powerups;
import java.util.Random;
public class PowerUps {
// public static PowerUp bigBomb = new PowerUpBigBomb("BIG BOMB", new Texture(Gdx.files.internal("data/powerups/bomb_big.png"))));
// public static PowerUp speed = new PowerUpSpeed("SPEED", new Texture(Gdx.files.internal("data/powerups/speed.png"))));
// public static PowerUp bigSpeed = new PowerUpBigSpeed("FASTER SPEED", new Texture(Gdx.files.internal("data/powerups/big_speed.png"))));
// public static PowerUp createWall = new PowerUpCreateWall("CREATE WALL", new Texture(Gdx.files.internal("data/powerups/wall.png"))));
// public static PowerUp floorHole = new PowerUpFloorHole("FLOOR HOLE", new Texture(Gdx.files.internal("data/powerups/floor_hole.png"))));
static Random rand = new Random();
public PowerUps() {
}
public static PowerUp pickRandomPU() {
switch (Math.abs(rand.nextInt()) % 12) {
case 0:
case 1:
case 2:
case 3:
return new PowerUpBomb();
case 4:
return new PowerUpBigBomb();
case 5:
case 6:
case 7:
return new PowerUpGiveBallAndChain();
case 8:
case 9:
return new PowerUpGiveSlug();
case 10:
case 11:
return new PowerUpFeather();
default:
return new PowerUpGiveBallAndChain();
}
}
}

View File

@ -3,8 +3,6 @@ package com.emamaker.amazeing.ui.screens;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
@ -210,12 +208,10 @@ public class PlayerChooseScreen extends MyScreen {
public void update() { public void update() {
// Consantly search for new players to be added // Consantly search for new players to be added
// First search for keyboard players (WASD and ARROWS) // First search for keyboard players (WASD and ARROWS)
if (Gdx.input.isKeyJustPressed(Keys.W) || Gdx.input.isKeyJustPressed(Keys.A) if (PlayerUtils.wasdPressed())
|| Gdx.input.isKeyJustPressed(Keys.S) || Gdx.input.isKeyJustPressed(Keys.D)) PlayerUtils.togglePlayerWithKeys(players, PlayerUtils.WASDKEYS);
PlayerUtils.togglePlayerWithKeys(players, Keys.W, Keys.S, Keys.A, Keys.D); if (PlayerUtils.arrowsPressed())
if (Gdx.input.isKeyJustPressed(Keys.UP) || Gdx.input.isKeyJustPressed(Keys.LEFT) PlayerUtils.togglePlayerWithKeys(players, PlayerUtils.ARROWKEYS);
|| Gdx.input.isKeyJustPressed(Keys.DOWN) || Gdx.input.isKeyJustPressed(Keys.RIGHT))
PlayerUtils.togglePlayerWithKeys(players, Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT);
// for (Controller c : Controllers.getControllers()) { // for (Controller c : Controllers.getControllers()) {
// System.out.println(c.getButton(Xbox.A)); // System.out.println(c.getButton(Xbox.A));

View File

@ -1,8 +0,0 @@
attribute vec4 a_position;
uniform mat4 u_projectionViewMatrix;
void main()
{
gl_Position = u_projectionViewMatrix * a_position;
}

Binary file not shown.

101
desktop/assets/data/default.fnt Executable file
View File

@ -0,0 +1,101 @@
info face="Droid Sans" size=17 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
common lineHeight=20 base=18 scaleW=256 scaleH=128 pages=1 packed=0
page id=0 file="default.png"
chars count=96
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=16 xadvance=4 page=0 chnl=0
char id=124 x=0 y=0 width=6 height=20 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0
char id=106 x=6 y=0 width=9 height=20 xoffset=-4 yoffset=3 xadvance=4 page=0 chnl=0
char id=81 x=15 y=0 width=15 height=19 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0
char id=74 x=30 y=0 width=11 height=19 xoffset=-5 yoffset=3 xadvance=4 page=0 chnl=0
char id=125 x=41 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0
char id=123 x=51 y=0 width=10 height=18 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0
char id=93 x=61 y=0 width=8 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0
char id=91 x=69 y=0 width=8 height=18 xoffset=-2 yoffset=3 xadvance=5 page=0 chnl=0
char id=41 x=77 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0
char id=40 x=86 y=0 width=9 height=18 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0
char id=64 x=95 y=0 width=18 height=17 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0
char id=121 x=113 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0
char id=113 x=126 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0
char id=112 x=139 y=0 width=13 height=17 xoffset=-2 yoffset=6 xadvance=9 page=0 chnl=0
char id=103 x=152 y=0 width=13 height=17 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0
char id=38 x=165 y=0 width=16 height=16 xoffset=-3 yoffset=3 xadvance=11 page=0 chnl=0
char id=37 x=181 y=0 width=18 height=16 xoffset=-3 yoffset=3 xadvance=14 page=0 chnl=0
char id=36 x=199 y=0 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=63 x=211 y=0 width=11 height=16 xoffset=-3 yoffset=3 xadvance=7 page=0 chnl=0
char id=33 x=222 y=0 width=7 height=16 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0
char id=48 x=229 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=57 x=242 y=0 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=56 x=0 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=54 x=13 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=53 x=26 y=20 width=12 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=51 x=38 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=100 x=51 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=98 x=64 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=85 x=77 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0
char id=83 x=91 y=20 width=13 height=16 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0
char id=79 x=104 y=20 width=15 height=16 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0
char id=71 x=119 y=20 width=14 height=16 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0
char id=67 x=133 y=20 width=13 height=16 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0
char id=127 x=146 y=20 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0
char id=35 x=158 y=20 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0
char id=92 x=173 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0
char id=47 x=184 y=20 width=11 height=15 xoffset=-3 yoffset=3 xadvance=6 page=0 chnl=0
char id=59 x=195 y=20 width=8 height=15 xoffset=-3 yoffset=6 xadvance=4 page=0 chnl=0
char id=55 x=203 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=52 x=216 y=20 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=50 x=230 y=20 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=49 x=243 y=20 width=9 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=116 x=0 y=36 width=10 height=15 xoffset=-3 yoffset=4 xadvance=5 page=0 chnl=0
char id=108 x=10 y=36 width=6 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0
char id=107 x=16 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0
char id=105 x=28 y=36 width=7 height=15 xoffset=-2 yoffset=3 xadvance=4 page=0 chnl=0
char id=104 x=35 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0
char id=102 x=47 y=36 width=11 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0
char id=90 x=58 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=89 x=71 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0
char id=88 x=84 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=87 x=98 y=36 width=19 height=15 xoffset=-3 yoffset=3 xadvance=15 page=0 chnl=0
char id=86 x=117 y=36 width=14 height=15 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=84 x=131 y=36 width=13 height=15 xoffset=-3 yoffset=3 xadvance=8 page=0 chnl=0
char id=82 x=144 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0
char id=80 x=157 y=36 width=12 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=78 x=169 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=12 page=0 chnl=0
char id=77 x=183 y=36 width=17 height=15 xoffset=-2 yoffset=3 xadvance=14 page=0 chnl=0
char id=76 x=200 y=36 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0
char id=75 x=211 y=36 width=13 height=15 xoffset=-2 yoffset=3 xadvance=9 page=0 chnl=0
char id=73 x=224 y=36 width=10 height=15 xoffset=-3 yoffset=3 xadvance=5 page=0 chnl=0
char id=72 x=234 y=36 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0
char id=70 x=0 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0
char id=69 x=11 y=51 width=11 height=15 xoffset=-2 yoffset=3 xadvance=8 page=0 chnl=0
char id=68 x=22 y=51 width=14 height=15 xoffset=-2 yoffset=3 xadvance=11 page=0 chnl=0
char id=66 x=36 y=51 width=13 height=15 xoffset=-2 yoffset=3 xadvance=10 page=0 chnl=0
char id=65 x=49 y=51 width=15 height=15 xoffset=-3 yoffset=3 xadvance=10 page=0 chnl=0
char id=58 x=64 y=51 width=7 height=13 xoffset=-2 yoffset=6 xadvance=4 page=0 chnl=0
char id=117 x=71 y=51 width=12 height=13 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0
char id=115 x=83 y=51 width=11 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0
char id=111 x=94 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0
char id=101 x=107 y=51 width=13 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0
char id=99 x=120 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0
char id=97 x=132 y=51 width=12 height=13 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0
char id=60 x=144 y=51 width=13 height=12 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0
char id=122 x=157 y=51 width=11 height=12 xoffset=-3 yoffset=6 xadvance=7 page=0 chnl=0
char id=120 x=168 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0
char id=119 x=181 y=51 width=17 height=12 xoffset=-3 yoffset=6 xadvance=12 page=0 chnl=0
char id=118 x=198 y=51 width=13 height=12 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0
char id=114 x=211 y=51 width=10 height=12 xoffset=-2 yoffset=6 xadvance=6 page=0 chnl=0
char id=110 x=221 y=51 width=12 height=12 xoffset=-2 yoffset=6 xadvance=10 page=0 chnl=0
char id=109 x=233 y=51 width=17 height=12 xoffset=-2 yoffset=6 xadvance=15 page=0 chnl=0
char id=94 x=0 y=66 width=13 height=11 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=62 x=13 y=66 width=13 height=11 xoffset=-3 yoffset=5 xadvance=9 page=0 chnl=0
char id=42 x=26 y=66 width=13 height=10 xoffset=-3 yoffset=3 xadvance=9 page=0 chnl=0
char id=43 x=39 y=66 width=13 height=10 xoffset=-3 yoffset=6 xadvance=9 page=0 chnl=0
char id=61 x=52 y=66 width=13 height=8 xoffset=-3 yoffset=7 xadvance=9 page=0 chnl=0
char id=39 x=65 y=66 width=6 height=8 xoffset=-2 yoffset=3 xadvance=3 page=0 chnl=0
char id=34 x=71 y=66 width=9 height=8 xoffset=-2 yoffset=3 xadvance=6 page=0 chnl=0
char id=44 x=80 y=66 width=8 height=7 xoffset=-3 yoffset=14 xadvance=4 page=0 chnl=0
char id=126 x=88 y=66 width=13 height=6 xoffset=-3 yoffset=8 xadvance=9 page=0 chnl=0
char id=46 x=101 y=66 width=7 height=6 xoffset=-2 yoffset=13 xadvance=4 page=0 chnl=0
char id=96 x=108 y=66 width=8 height=6 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0
char id=45 x=116 y=66 width=9 height=5 xoffset=-3 yoffset=10 xadvance=5 page=0 chnl=0
char id=95 x=125 y=66 width=13 height=4 xoffset=-4 yoffset=17 xadvance=6 page=0 chnl=0
kernings count=-1

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

View File

@ -0,0 +1,10 @@
#ifdef GL_ES
precision mediump float;
#endif
varying vec2 v_texCoord0;
void main() {
gl_FragColor = vec4(v_texCoord0, 0.0, 1.0);
}

View File

@ -0,0 +1,13 @@
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec2 a_texCoord0;
uniform mat4 u_worldTrans;
uniform mat4 u_projViewTrans;
varying vec2 v_texCoord0;
void main() {
v_texCoord0 = a_texCoord0;
gl_Position = u_projViewTrans * u_worldTrans * vec4(a_position, 1.0);
}

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

200
desktop/assets/data/uiskin.atlas Executable file
View File

@ -0,0 +1,200 @@
uiskin.png
size: 256,128
format: RGBA8888
filter: Linear,Linear
repeat: none
check-off
rotate: false
xy: 11, 5
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
textfield
rotate: false
xy: 11, 5
size: 14, 14
split: 3, 3, 3, 3
orig: 14, 14
offset: 0, 0
index: -1
check-on
rotate: false
xy: 125, 35
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
cursor
rotate: false
xy: 23, 1
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
default
rotate: false
xy: 1, 50
size: 254, 77
orig: 254, 77
offset: 0, 0
index: -1
default-pane
rotate: false
xy: 11, 1
size: 5, 3
split: 1, 1, 1, 1
orig: 5, 3
offset: 0, 0
index: -1
default-rect-pad
rotate: false
xy: 11, 1
size: 5, 3
split: 1, 1, 1, 1
orig: 5, 3
offset: 0, 0
index: -1
default-pane-noborder
rotate: false
xy: 170, 44
size: 1, 1
split: 0, 0, 0, 0
orig: 1, 1
offset: 0, 0
index: -1
default-rect
rotate: false
xy: 38, 25
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
default-rect-down
rotate: false
xy: 170, 46
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
default-round
rotate: false
xy: 112, 29
size: 12, 20
split: 5, 5, 5, 4
pad: 4, 4, 1, 1
orig: 12, 20
offset: 0, 0
index: -1
default-round-down
rotate: false
xy: 99, 29
size: 12, 20
split: 5, 5, 5, 4
pad: 4, 4, 1, 1
orig: 12, 20
offset: 0, 0
index: -1
default-round-large
rotate: false
xy: 57, 29
size: 20, 20
split: 5, 5, 5, 4
orig: 20, 20
offset: 0, 0
index: -1
default-scroll
rotate: false
xy: 78, 29
size: 20, 20
split: 2, 2, 2, 2
orig: 20, 20
offset: 0, 0
index: -1
default-select
rotate: false
xy: 29, 29
size: 27, 20
split: 4, 14, 4, 4
orig: 27, 20
offset: 0, 0
index: -1
default-select-selection
rotate: false
xy: 26, 16
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
offset: 0, 0
index: -1
default-slider
rotate: false
xy: 29, 20
size: 8, 8
split: 2, 2, 2, 2
orig: 8, 8
offset: 0, 0
index: -1
default-slider-knob
rotate: false
xy: 1, 1
size: 9, 18
orig: 9, 18
offset: 0, 0
index: -1
default-splitpane
rotate: false
xy: 17, 1
size: 5, 3
split: 0, 5, 0, 0
orig: 5, 3
offset: 0, 0
index: -1
default-splitpane-vertical
rotate: false
xy: 125, 29
size: 3, 5
split: 0, 0, 0, 5
orig: 3, 5
offset: 0, 0
index: -1
default-window
rotate: false
xy: 1, 20
size: 27, 29
split: 4, 3, 20, 3
orig: 27, 29
offset: 0, 0
index: -1
selection
rotate: false
xy: 174, 48
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
tree-minus
rotate: false
xy: 140, 35
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
tree-plus
rotate: false
xy: 155, 35
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
white
rotate: false
xy: 129, 31
size: 3, 3
orig: 3, 3
offset: 0, 0
index: -1

70
desktop/assets/data/uiskin.json Executable file
View File

@ -0,0 +1,70 @@
{
BitmapFont: { default-font: { file: default.fnt } },
Color: {
green: { a: 1, b: 0, g: 1, r: 0 },
white: { a: 1, b: 1, g: 1, r: 1 },
red: { a: 1, b: 0, g: 0, r: 1 },
black: { a: 1, b: 0, g: 0, r: 0 },
},
TintedDrawable: {
dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } },
},
ButtonStyle: {
default: { down: default-round-down, up: default-round },
toggle: { parent: default, checked: default-round-down }
},
TextButtonStyle: {
default: { parent: default, font: default-font, fontColor: white },
toggle: { parent: default, checked: default-round-down, downFontColor: red }
},
ScrollPaneStyle: {
default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
SelectBoxStyle: {
default: {
font: default-font, fontColor: white, background: default-select,
scrollStyle: default,
listStyle: { font: default-font, selection: default-select-selection }
}
},
SplitPaneStyle: {
default-vertical: { handle: default-splitpane-vertical },
default-horizontal: { handle: default-splitpane }
},
WindowStyle: {
default: { titleFont: default-font, background: default-window, titleFontColor: white },
dialog: { parent: default, stageBackground: dialogDim }
},
ProgressBarStyle: {
default-horizontal: { background: default-slider, knob: default-slider-knob },
default-vertical: { background: default-slider, knob: default-round-large }
},
SliderStyle: {
default-horizontal: { parent: default-horizontal },
default-vertical: { parent: default-vertical }
},
LabelStyle: {
default: { font: default-font, fontColor: white }
},
TextFieldStyle: {
default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor }
},
CheckBoxStyle: {
default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white }
},
ListStyle: {
default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font }
},
TouchpadStyle: {
default: { background: default-pane, knob: default-round-large }
},
TreeStyle: {
default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
},
TextTooltipStyle: {
default: {
label: { font: default-font, fontColor: white },
background: default-pane, wrapWidth: 150
}
},
}

BIN
desktop/assets/data/uiskin.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -5,13 +5,13 @@ import org.robovm.apple.uikit.UIApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import com.emamaker.amazeing.AMazeIng; import com.emamaker.amazeing.AMazeIng.Platform;
public class IOSLauncher extends IOSApplication.Delegate { public class IOSLauncher extends IOSApplication.Delegate {
@Override @Override
protected IOSApplication createApplication() { protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration(); IOSApplicationConfiguration config = new IOSApplicationConfiguration();
return new IOSApplication(new AMazeIng(), config); return new IOSApplication(new AMazeIng(Platform.IOS), config);
} }
public static void main(String[] argv) { public static void main(String[] argv) {