Various
Some level changes Some cosmetic changes Added in working score and semi-working leaderboard
11
core/assets/Leaderboard.csv
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Level 2,1200.0,
|
||||||
|
Level 3,1700.0,
|
||||||
|
Level 4,1400.0,
|
||||||
|
Level 1,1100,
|
||||||
|
Level 2,1200,
|
||||||
|
Level 3,1700,
|
||||||
|
Level 4,1400,
|
||||||
|
Level 5,1300,
|
||||||
|
Level 6,1800,
|
||||||
|
Level 7,1300,
|
||||||
|
Level 8,1200,
|
|
|
@ -23,7 +23,7 @@
|
||||||
</tileset>
|
</tileset>
|
||||||
<layer name="PLATFORM" width="50" height="8">
|
<layer name="PLATFORM" width="50" height="8">
|
||||||
<data encoding="base64" compression="zlib">
|
<data encoding="base64" compression="zlib">
|
||||||
eJxjYBgFwx2wIGEmAniwAWS3kwKYkfBAA1LdTg4gNx5ZcGBscsQARjyYkDpK3YtNLSmAVLcQq45SgMvPgwEDALPDAS4=
|
eJxjYBgFwx2wIGEmAniwAWS3kwKYkfBAA1LdTg4gNx5ZcGBs8sQARjyYkDpquBddLSmAVLcQq45SgMvPgwEDAKszASo=
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup name="PLAYER">
|
<objectgroup name="PLAYER">
|
||||||
|
|
|
@ -7,6 +7,7 @@ com.badlogic.gdx.graphics.Color: {
|
||||||
},
|
},
|
||||||
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
|
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
|
||||||
default: { down: null, up: null, font: default-font, fontColor: white, overFontColor: red }
|
default: { down: null, up: null, font: default-font, fontColor: white, overFontColor: red }
|
||||||
|
intro: { down: null, up: null, font: default-font, fontColor: green, overFontColor: red }
|
||||||
},
|
},
|
||||||
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
|
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
|
||||||
default: { font: default-font, fontColor: white }
|
default: { font: default-font, fontColor: white }
|
||||||
|
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 68 KiB |
|
@ -89,5 +89,9 @@ public class Enemy extends Base {
|
||||||
|
|
||||||
public void setAlive(boolean isAlive) { this.isAlive = isAlive; }
|
public void setAlive(boolean isAlive) { this.isAlive = isAlive; }
|
||||||
|
|
||||||
|
public boolean isAlive(){
|
||||||
|
return isAlive;
|
||||||
|
}
|
||||||
|
|
||||||
public Array<Fixture> getFixtures() { return body.getFixtureList(); }
|
public Array<Fixture> getFixtures() { return body.getFixtureList(); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,12 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.game.App;
|
import com.game.App;
|
||||||
import com.game.managers.ScreenManager;
|
import com.game.managers.ScreenManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ash on 11/02/2016.
|
* Created by Ash on 11/02/2016.
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +29,9 @@ public class Leaderboard extends AbstractScreen {
|
||||||
private TextButton butBack;
|
private TextButton butBack;
|
||||||
|
|
||||||
|
|
||||||
|
//Score
|
||||||
|
private ArrayList<String> leaderboardValues = new ArrayList<>();
|
||||||
|
|
||||||
public Leaderboard(App app) {
|
public Leaderboard(App app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
|
@ -33,10 +42,22 @@ public class Leaderboard extends AbstractScreen {
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
super.show();
|
super.show();
|
||||||
|
leaderboardValues = new ArrayList<>();
|
||||||
skin.add("default-font", app.assets.get("badaboom45.ttf", BitmapFont.class));
|
skin.add("default-font", app.assets.get("badaboom45.ttf", BitmapFont.class));
|
||||||
skin.load(Gdx.files.internal("spritesheets/uiskin.json"));
|
skin.load(Gdx.files.internal("spritesheets/uiskin.json"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
Scanner scanner = new Scanner(new File("Leaderboard.csv"));
|
||||||
|
scanner.useDelimiter(",");
|
||||||
|
while(scanner.hasNext()){
|
||||||
|
leaderboardValues.add(scanner.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(leaderboardValues);
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
initButtons();
|
initButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +72,14 @@ public class Leaderboard extends AbstractScreen {
|
||||||
|
|
||||||
app.sb.begin();
|
app.sb.begin();
|
||||||
app.sb.draw(app.assets.get("textures/backgrounds/leaderboardBackground.jpg", Texture.class), 0, 0);
|
app.sb.draw(app.assets.get("textures/backgrounds/leaderboardBackground.jpg", Texture.class), 0, 0);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for(int col = 0; col < leaderboardValues.size()/2; col++){
|
||||||
|
for(int row = 0; row < 2; row ++){
|
||||||
|
app.assets.get("badaboom45.ttf", BitmapFont.class).draw(app.sb, leaderboardValues.get(count++), 100 + (400 * row), 500 + (-50 * col));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.sb.end();
|
app.sb.end();
|
||||||
|
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
|
|
@ -14,6 +14,8 @@ import com.game.misc.levelSelectClickListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ash on 11/02/2016.
|
* Created by Ash on 11/02/2016.
|
||||||
*/
|
*/
|
||||||
|
@ -107,6 +109,7 @@ public class LevelSelect extends AbstractScreen {
|
||||||
@Override
|
@Override
|
||||||
public void clicked (com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
|
public void clicked (com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
|
||||||
//app.sm.setScreen(ScreenManager.Screen.ENDLESSMODE); TODO, finish this ;)
|
//app.sm.setScreen(ScreenManager.Screen.ENDLESSMODE); TODO, finish this ;)
|
||||||
|
butEndless.addAction(forever(moveBy(20, 3)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.game.App;
|
import com.game.App;
|
||||||
import com.game.managers.ScreenManager;
|
import com.game.managers.ScreenManager;
|
||||||
|
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ash on 11/02/2016.
|
* Created by Ash on 11/02/2016.
|
||||||
*/
|
*/
|
||||||
|
@ -131,6 +134,15 @@ public class Loading extends AbstractScreen {
|
||||||
// Sound
|
// Sound
|
||||||
app.assets.load("sounds/jumping.mp3", Sound.class);
|
app.assets.load("sounds/jumping.mp3", Sound.class);
|
||||||
app.assets.load("sounds/colourchange.mp3", Sound.class);
|
app.assets.load("sounds/colourchange.mp3", Sound.class);
|
||||||
|
try {
|
||||||
|
FileWriter leaderboard = new FileWriter("Leaderboard.csv", true);
|
||||||
|
|
||||||
|
leaderboard.flush();
|
||||||
|
leaderboard.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadFont(String fontFileName, int size, Color borderColour)
|
private void loadFont(String fontFileName, int size, Color borderColour)
|
||||||
|
|
|
@ -35,6 +35,9 @@ import com.game.misc.utils.myWindow;
|
||||||
import com.game.misc.utils.Box2dUtils;
|
import com.game.misc.utils.Box2dUtils;
|
||||||
import com.game.misc.utils.CameraUtils;
|
import com.game.misc.utils.CameraUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -87,6 +90,10 @@ public class Play extends AbstractScreen {
|
||||||
private float progressX;
|
private float progressX;
|
||||||
private Image uiRedImage, uiGreenImage, uiBlueImage;
|
private Image uiRedImage, uiGreenImage, uiBlueImage;
|
||||||
|
|
||||||
|
//Score
|
||||||
|
private int score = 0;
|
||||||
|
private float scoreYPos = 100;
|
||||||
|
|
||||||
public Play(App app, int levelNumber) {
|
public Play(App app, int levelNumber) {
|
||||||
super(app);
|
super(app);
|
||||||
this.levelNumber = levelNumber;
|
this.levelNumber = levelNumber;
|
||||||
|
@ -186,6 +193,7 @@ public class Play extends AbstractScreen {
|
||||||
uiGreenImage.draw(app.sb, 1f);
|
uiGreenImage.draw(app.sb, 1f);
|
||||||
uiBlueImage.draw(app.sb, 1f);
|
uiBlueImage.draw(app.sb, 1f);
|
||||||
app.sb.draw(progressTexture, progressX, progressRect.y, 30, 30);
|
app.sb.draw(progressTexture, progressX, progressRect.y, 30, 30);
|
||||||
|
app.assets.get("badaboom60.ttf", BitmapFont.class).draw(app.sb, "Score: " + score, 500, scoreYPos);
|
||||||
app.sb.end();
|
app.sb.end();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -297,8 +305,8 @@ public class Play extends AbstractScreen {
|
||||||
TextureMapObject tmo = (TextureMapObject)enemyObjs.get(i);
|
TextureMapObject tmo = (TextureMapObject)enemyObjs.get(i);
|
||||||
MapProperties mp = tmo.getProperties();
|
MapProperties mp = tmo.getProperties();
|
||||||
|
|
||||||
if(mp.get("Colour").equals("RED")) { enemies.add(new Enemy(world, new Vector2(tmo.getX(), tmo.getY()), new Vector2(64, 64), Base.Colours.RED, BIT_ALL, BIT_PLAYER)); }
|
if(mp.get("Colour").equals("RED")) { enemies.add(new Enemy(world, new Vector2(tmo.getX() + 32, tmo.getY() + 32), new Vector2(64, 64), Base.Colours.RED, BIT_ALL, BIT_PLAYER)); }
|
||||||
else if(mp.get("Colour").equals("GREEN")) { enemies.add(new Enemy(world, new Vector2(tmo.getX(), tmo.getY()), new Vector2(64, 64), Base.Colours.GREEN, BIT_ALL, BIT_PLAYER)); }
|
else if(mp.get("Colour").equals("GREEN")) { enemies.add(new Enemy(world, new Vector2(tmo.getX() + 32, tmo.getY() + 32), new Vector2(64, 64), Base.Colours.GREEN, BIT_ALL, BIT_PLAYER)); }
|
||||||
else if(mp.get("Colour").equals("BLUE")) { enemies.add(new Enemy(world, new Vector2(tmo.getX() + 32, tmo.getY() + 32), new Vector2(64, 64), Base.Colours.GREEN, BIT_ALL, BIT_PLAYER)); }
|
else if(mp.get("Colour").equals("BLUE")) { enemies.add(new Enemy(world, new Vector2(tmo.getX() + 32, tmo.getY() + 32), new Vector2(64, 64), Base.Colours.GREEN, BIT_ALL, BIT_PLAYER)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +364,7 @@ public class Play extends AbstractScreen {
|
||||||
|
|
||||||
// Init INTRO buttons
|
// Init INTRO buttons
|
||||||
myWindow tempWindow = windows.get(GameState.INTRO);
|
myWindow tempWindow = windows.get(GameState.INTRO);
|
||||||
tempWindow.addButton(new myButton("Continue", new Vector2((tempWindow.getX() * 2) - 5, tempWindow.getHeight() - 50), skin, "default", new ClickListener() {
|
tempWindow.addButton(new myButton("Continue", new Vector2((tempWindow.getX() * 2) - 5, tempWindow.getHeight() - 50), skin, "intro", new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
|
public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
|
||||||
setCurGameState(GameState.PLAYING);
|
setCurGameState(GameState.PLAYING);
|
||||||
|
@ -438,6 +446,21 @@ public class Play extends AbstractScreen {
|
||||||
curGameState = newGameState;
|
curGameState = newGameState;
|
||||||
System.out.println("Showing: " + curGameState.name() + " window");
|
System.out.println("Showing: " + curGameState.name() + " window");
|
||||||
windows.get(curGameState).setVisible(true); // show new window
|
windows.get(curGameState).setVisible(true); // show new window
|
||||||
|
if(curGameState == GameState.SUCCESS){
|
||||||
|
scoreYPos = 650;
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileWriter leaderboard = new FileWriter("Leaderboard.csv", true);
|
||||||
|
|
||||||
|
leaderboard.append("Level " + levelNumber + "," + score + ",\n");
|
||||||
|
|
||||||
|
leaderboard.flush();
|
||||||
|
leaderboard.close();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contact Listener
|
// Contact Listener
|
||||||
|
@ -466,8 +489,12 @@ public class Play extends AbstractScreen {
|
||||||
{
|
{
|
||||||
if(e.getFixtures().contains(fa, false) || e.getFixtures().contains(fb, false))
|
if(e.getFixtures().contains(fa, false) || e.getFixtures().contains(fb, false))
|
||||||
{
|
{
|
||||||
e.setAlive(false);
|
if(e.isAlive()) {
|
||||||
e.setCurColour(e.getCurColour());
|
e.setAlive(false);
|
||||||
|
e.setCurColour(e.getCurColour());
|
||||||
|
score += 100;
|
||||||
|
System.out.println(score);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,6 +502,7 @@ public class Play extends AbstractScreen {
|
||||||
if(fa.getUserData().equals("PLAYER") && fb.getUserData().equals("PASSBOUNDARY") ||
|
if(fa.getUserData().equals("PLAYER") && fb.getUserData().equals("PASSBOUNDARY") ||
|
||||||
fb.getUserData().equals("PLAYER") && fa.getUserData().equals("PASSBOUNDARY"))
|
fb.getUserData().equals("PLAYER") && fa.getUserData().equals("PASSBOUNDARY"))
|
||||||
{
|
{
|
||||||
|
score += 1000;
|
||||||
setCurGameState(GameState.SUCCESS);
|
setCurGameState(GameState.SUCCESS);
|
||||||
System.out.println("SUCCESS");
|
System.out.println("SUCCESS");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,5 +18,6 @@ public class DesktopLauncher {
|
||||||
config.addIcon("spritesheets/icon.jpg", Files.FileType.Internal);
|
config.addIcon("spritesheets/icon.jpg", Files.FileType.Internal);
|
||||||
config.foregroundFPS = (int)Vars.FRAMERATE;
|
config.foregroundFPS = (int)Vars.FRAMERATE;
|
||||||
config.backgroundFPS = (int)Vars.FRAMERATE;
|
config.backgroundFPS = (int)Vars.FRAMERATE;
|
||||||
|
config.samples = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|