Some level changes
Some cosmetic changes
Added in working score and semi-working leaderboard
This commit is contained in:
ESloman 2016-02-23 11:31:55 +00:00
parent 11a944a808
commit 93f9317de6
16 changed files with 96 additions and 7 deletions

View 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,
1 Level 2 1200.0
2 Level 3 1700.0
3 Level 4 1400.0
4 Level 1 1100
5 Level 2 1200
6 Level 3 1700
7 Level 4 1400
8 Level 5 1300
9 Level 6 1800
10 Level 7 1300
11 Level 8 1200

View file

@ -23,7 +23,7 @@
</tileset>
<layer name="PLATFORM" width="50" height="8">
<data encoding="base64" compression="zlib">
eJxjYBgFwx2wIGEmAniwAWS3kwKYkfBAA1LdTg4gNx5ZcGBscsQARjyYkDpK3YtNLSmAVLcQq45SgMvPgwEDALPDAS4=
eJxjYBgFwx2wIGEmAniwAWS3kwKYkfBAA1LdTg4gNx5ZcGBs8sQARjyYkDpquBddLSmAVLcQq45SgMvPgwEDAKszASo=
</data>
</layer>
<objectgroup name="PLAYER">

View file

@ -7,6 +7,7 @@ com.badlogic.gdx.graphics.Color: {
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
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: {
default: { font: default-font, fontColor: white }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View file

@ -89,5 +89,9 @@ public class Enemy extends Base {
public void setAlive(boolean isAlive) { this.isAlive = isAlive; }
public boolean isAlive(){
return isAlive;
}
public Array<Fixture> getFixtures() { return body.getFixtureList(); }
}

View file

@ -11,6 +11,12 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.game.App;
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.
*/
@ -23,6 +29,9 @@ public class Leaderboard extends AbstractScreen {
private TextButton butBack;
//Score
private ArrayList<String> leaderboardValues = new ArrayList<>();
public Leaderboard(App app) {
super(app);
@ -33,10 +42,22 @@ public class Leaderboard extends AbstractScreen {
@Override
public void show() {
super.show();
leaderboardValues = new ArrayList<>();
skin.add("default-font", app.assets.get("badaboom45.ttf", BitmapFont.class));
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();
}
@ -51,6 +72,14 @@ public class Leaderboard extends AbstractScreen {
app.sb.begin();
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();
stage.draw();

View file

@ -14,6 +14,8 @@ import com.game.misc.levelSelectClickListener;
import java.util.ArrayList;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
/**
* Created by Ash on 11/02/2016.
*/
@ -107,6 +109,7 @@ public class LevelSelect extends AbstractScreen {
@Override
public void clicked (com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
//app.sm.setScreen(ScreenManager.Screen.ENDLESSMODE); TODO, finish this ;)
butEndless.addAction(forever(moveBy(20, 3)));
}
});

View file

@ -16,6 +16,9 @@ import com.badlogic.gdx.math.Rectangle;
import com.game.App;
import com.game.managers.ScreenManager;
import java.io.FileWriter;
import java.io.IOException;
/**
* Created by Ash on 11/02/2016.
*/
@ -131,6 +134,15 @@ public class Loading extends AbstractScreen {
// Sound
app.assets.load("sounds/jumping.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)

View file

@ -35,6 +35,9 @@ import com.game.misc.utils.myWindow;
import com.game.misc.utils.Box2dUtils;
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.HashMap;
@ -87,6 +90,10 @@ public class Play extends AbstractScreen {
private float progressX;
private Image uiRedImage, uiGreenImage, uiBlueImage;
//Score
private int score = 0;
private float scoreYPos = 100;
public Play(App app, int levelNumber) {
super(app);
this.levelNumber = levelNumber;
@ -186,6 +193,7 @@ public class Play extends AbstractScreen {
uiGreenImage.draw(app.sb, 1f);
uiBlueImage.draw(app.sb, 1f);
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();
}
else
@ -297,8 +305,8 @@ public class Play extends AbstractScreen {
TextureMapObject tmo = (TextureMapObject)enemyObjs.get(i);
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)); }
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)); }
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() + 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
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
public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) {
setCurGameState(GameState.PLAYING);
@ -438,6 +446,21 @@ public class Play extends AbstractScreen {
curGameState = newGameState;
System.out.println("Showing: " + curGameState.name() + " 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
@ -466,8 +489,12 @@ public class Play extends AbstractScreen {
{
if(e.getFixtures().contains(fa, false) || e.getFixtures().contains(fb, false))
{
if(e.isAlive()) {
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") ||
fb.getUserData().equals("PLAYER") && fa.getUserData().equals("PASSBOUNDARY"))
{
score += 1000;
setCurGameState(GameState.SUCCESS);
System.out.println("SUCCESS");
return;

View file

@ -18,5 +18,6 @@ public class DesktopLauncher {
config.addIcon("spritesheets/icon.jpg", Files.FileType.Internal);
config.foregroundFPS = (int)Vars.FRAMERATE;
config.backgroundFPS = (int)Vars.FRAMERATE;
config.samples = 4;
}
}