added groundwork for scoring and minor tweaks to textures
Before Width: | Height: | Size: 616 KiB After Width: | Height: | Size: 738 KiB |
Before Width: | Height: | Size: 799 KiB After Width: | Height: | Size: 947 KiB |
Before Width: | Height: | Size: 754 KiB After Width: | Height: | Size: 891 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 2.0 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 4.0 MiB |
Before Width: | Height: | Size: 366 KiB After Width: | Height: | Size: 424 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
@ -195,6 +195,9 @@ public class RhythmBullet extends Game {
|
|||||||
subTextbutton.font = getDefaultSkin().getFont("sub-font");
|
subTextbutton.font = getDefaultSkin().getFont("sub-font");
|
||||||
getDefaultSkin().add("sub", subTextbutton);
|
getDefaultSkin().add("sub", subTextbutton);
|
||||||
|
|
||||||
|
TextButtonStyle windowTextButton = new TextButtonStyle(defaultTextButton);
|
||||||
|
windowTextButton.font = getDefaultSkin().getFont("window-font");
|
||||||
|
getDefaultSkin().add("window", windowTextButton);
|
||||||
|
|
||||||
TextButtonStyle textButtonLeft = new TextButtonStyle();
|
TextButtonStyle textButtonLeft = new TextButtonStyle();
|
||||||
textButtonLeft.up = getDefaultSkin().getDrawable("left-button");
|
textButtonLeft.up = getDefaultSkin().getDrawable("left-button");
|
||||||
|
@ -23,6 +23,7 @@ public class CollisionDetector {
|
|||||||
ParticleEffectPool explosionEffectPool;
|
ParticleEffectPool explosionEffectPool;
|
||||||
Array<PooledEffect> effects = new Array<>();
|
Array<PooledEffect> effects = new Array<>();
|
||||||
|
|
||||||
|
private int amassedPoints;
|
||||||
Sound explosionSFX;
|
Sound explosionSFX;
|
||||||
public CollisionDetector(Array<Entity> enemies, Array<Entity> allies, AssetManager assetManager, Preferences prefs) {
|
public CollisionDetector(Array<Entity> enemies, Array<Entity> allies, AssetManager assetManager, Preferences prefs) {
|
||||||
this.enemies = enemies;
|
this.enemies = enemies;
|
||||||
@ -58,6 +59,8 @@ public class CollisionDetector {
|
|||||||
|
|
||||||
enemy.collided(ally);
|
enemy.collided(ally);
|
||||||
ally.collided(enemy);
|
ally.collided(enemy);
|
||||||
|
|
||||||
|
amassedPoints += enemy.getPoints();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,4 +92,10 @@ public class CollisionDetector {
|
|||||||
batch.end();
|
batch.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAmassedPoints() {
|
||||||
|
int amassedPoints = this.amassedPoints;
|
||||||
|
this.amassedPoints = 0;
|
||||||
|
return amassedPoints;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class Entity extends Actor implements Poolable {
|
|||||||
public float angle;
|
public float angle;
|
||||||
public float speed;
|
public float speed;
|
||||||
|
|
||||||
|
protected int points;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called by the entity frame and only once (when this object is created).
|
* called by the entity frame and only once (when this object is created).
|
||||||
@ -162,6 +162,7 @@ public class Entity extends Actor implements Poolable {
|
|||||||
center.set(0, 0);
|
center.set(0, 0);
|
||||||
angle = 0;
|
angle = 0;
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
points = 0;
|
||||||
dead = false;
|
dead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,4 +186,8 @@ public class Entity extends Actor implements Poolable {
|
|||||||
this.coordinator = coordinator;
|
this.coordinator = coordinator;
|
||||||
coordinator.setEntity(this);
|
coordinator.setEntity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPoints() {
|
||||||
|
return points + (coordinator != null ? coordinator.getScoreBonus() : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,21 +9,23 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.entity.Entity;
|
import zero1hd.rhythmbullet.entity.Entity;
|
||||||
|
import zero1hd.rhythmbullet.ui.builders.HealthBar;
|
||||||
|
|
||||||
public class PolyJetEntity extends Entity {
|
public class PolyJetEntity extends Entity {
|
||||||
public float health;
|
public float health;
|
||||||
private ParticleEffect thrust;
|
private ParticleEffect thrust;
|
||||||
private Texture polyjet;
|
private Texture polyjet;
|
||||||
private ParticleEffect teleportCloak;
|
private ParticleEffect teleportCloak;
|
||||||
|
private HealthBar hpBar;
|
||||||
public boolean moveLeft, moveRight, moveUp, moveDown, teleporting, accelerate;
|
public boolean moveLeft, moveRight, moveUp, moveDown, teleporting, accelerate;
|
||||||
private float speed, accel;
|
private float speed, accel;
|
||||||
private float rate;
|
private float rate;
|
||||||
public PolyJetEntity(AssetManager assets, float speed, float accel, String jet) {
|
public PolyJetEntity(AssetManager assets, float speed, float accel, String jet, HealthBar hpBar) {
|
||||||
nonStnrd = true;
|
nonStnrd = true;
|
||||||
health = 100;
|
health = 100;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.accel = accel;
|
this.accel = accel;
|
||||||
|
this.hpBar = hpBar;
|
||||||
setSize(1.5f, 1.5f);
|
setSize(1.5f, 1.5f);
|
||||||
setPosition(RhythmBullet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
setPosition(RhythmBullet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
||||||
|
|
||||||
@ -70,6 +72,8 @@ public class PolyJetEntity extends Entity {
|
|||||||
|
|
||||||
if (health <= 0) {
|
if (health <= 0) {
|
||||||
dead = true;
|
dead = true;
|
||||||
|
} else if (health > hpBar.getMaxHealth()) {
|
||||||
|
health = hpBar.getMaxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
@ -89,4 +93,9 @@ public class PolyJetEntity extends Entity {
|
|||||||
public Rectangle getHitbox() {
|
public Rectangle getHitbox() {
|
||||||
return hitbox;
|
return hitbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHealth(float health) {
|
||||||
|
hpBar.setHealth(health);
|
||||||
|
this.health = health;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ public class Coordinator implements Poolable {
|
|||||||
private CoordinatorFrame<? extends Coordinator> cf;
|
private CoordinatorFrame<? extends Coordinator> cf;
|
||||||
protected EntityManager em;
|
protected EntityManager em;
|
||||||
protected Entity entity;
|
protected Entity entity;
|
||||||
|
protected int scoreBonus;
|
||||||
|
|
||||||
public void setup(EntityManager em, CoordinatorFrame<? extends Coordinator> cf) {
|
public void setup(EntityManager em, CoordinatorFrame<? extends Coordinator> cf) {
|
||||||
this.em = em;
|
this.em = em;
|
||||||
@ -34,4 +35,8 @@ public class Coordinator implements Poolable {
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
entity = null;
|
entity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getScoreBonus() {
|
||||||
|
return scoreBonus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ public class Pellet extends Entity implements Poolable {
|
|||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vars: x, y, speed, angle;
|
* Vars: x, y, speed, angle;
|
||||||
*/
|
*/
|
||||||
|
@ -10,10 +10,12 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.ui.stages.CreativeHUD;
|
import zero1hd.rhythmbullet.ui.stages.CreativeHUD;
|
||||||
|
import zero1hd.rhythmbullet.ui.stages.GameHUD;
|
||||||
import zero1hd.rhythmbullet.ui.stages.GamePlayArea;
|
import zero1hd.rhythmbullet.ui.stages.GamePlayArea;
|
||||||
|
|
||||||
public class CreativeDebugScreen extends ScreenAdapter {
|
public class CreativeScreen extends ScreenAdapter {
|
||||||
CreativeHUD creative;
|
CreativeHUD chud;
|
||||||
|
GameHUD ghud;
|
||||||
GamePlayArea gamePlayArea;
|
GamePlayArea gamePlayArea;
|
||||||
InputMultiplexer inputs;
|
InputMultiplexer inputs;
|
||||||
|
|
||||||
@ -22,12 +24,12 @@ public class CreativeDebugScreen extends ScreenAdapter {
|
|||||||
|
|
||||||
Preferences prefs;
|
Preferences prefs;
|
||||||
|
|
||||||
public CreativeDebugScreen(RhythmBullet core, MainMenu mainMenu) {
|
public CreativeScreen(RhythmBullet core, MainMenu mainMenu) {
|
||||||
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
ghud = new GameHUD(core.getDefaultSkin(), 100f);
|
||||||
creative = new CreativeHUD(core, mainMenu, gamePlayArea);
|
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs(), ghud);
|
||||||
|
chud = new CreativeHUD(core, mainMenu, gamePlayArea);
|
||||||
inputs = new InputMultiplexer(creative, gamePlayArea);
|
inputs = new InputMultiplexer(chud, gamePlayArea);
|
||||||
|
|
||||||
this.prefs = core.getPrefs();
|
this.prefs = core.getPrefs();
|
||||||
|
|
||||||
background = core.getAssetManager().get("star_bg.png");
|
background = core.getAssetManager().get("star_bg.png");
|
||||||
@ -55,9 +57,13 @@ public class CreativeDebugScreen extends ScreenAdapter {
|
|||||||
gamePlayArea.act();
|
gamePlayArea.act();
|
||||||
gamePlayArea.draw();
|
gamePlayArea.draw();
|
||||||
|
|
||||||
creative.getViewport().apply();
|
ghud.getViewport().apply();
|
||||||
creative.act();
|
ghud.act();
|
||||||
creative.draw();
|
ghud.draw();
|
||||||
|
|
||||||
|
chud.getViewport().apply();
|
||||||
|
chud.act();
|
||||||
|
chud.draw();
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +46,8 @@ public class GameScreen extends ScreenAdapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gameArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
gameHUD = new GameHUD(core.getDefaultSkin(), 100f);
|
||||||
gameHUD = new GameHUD(core.getDefaultSkin(), gameArea.getMaxHealth());
|
gameArea = new GamePlayArea(core.getAssetManager(), core.getPrefs(), gameHUD);
|
||||||
|
|
||||||
inputs = new InputMultiplexer();
|
inputs = new InputMultiplexer();
|
||||||
inputs.addProcessor(gameHUD);
|
inputs.addProcessor(gameHUD);
|
||||||
@ -113,7 +113,6 @@ public class GameScreen extends ScreenAdapter {
|
|||||||
|
|
||||||
//actual game and hud
|
//actual game and hud
|
||||||
if (!gameHUD.isPaused()) {
|
if (!gameHUD.isPaused()) {
|
||||||
gameHUD.setScore(gameArea.getScore());
|
|
||||||
gameArea.act(delta);
|
gameArea.act(delta);
|
||||||
if (gameArea.getPolyjet().isDead()) {
|
if (gameArea.getPolyjet().isDead()) {
|
||||||
end(false);
|
end(false);
|
||||||
|
@ -9,9 +9,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
|||||||
public class HealthBar extends WidgetGroup {
|
public class HealthBar extends WidgetGroup {
|
||||||
Image empty;
|
Image empty;
|
||||||
Image filler;
|
Image filler;
|
||||||
int health;
|
float health;
|
||||||
int maxHealth;
|
float maxHealth;
|
||||||
public HealthBar(Skin skin, int maxHealth) {
|
public HealthBar(Skin skin, float maxHealth) {
|
||||||
super();
|
super();
|
||||||
filler = new Image(skin.getPatch("bar-fill"));
|
filler = new Image(skin.getPatch("bar-fill"));
|
||||||
addActor(filler);
|
addActor(filler);
|
||||||
@ -24,7 +24,7 @@ public class HealthBar extends WidgetGroup {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHealth(int health) {
|
public void setHealth(float health) {
|
||||||
this.health = health;
|
this.health = health;
|
||||||
|
|
||||||
filler.addAction(Actions.sizeTo(getWidth(), MathUtils.round((health/maxHealth)*getHeight()), 0.1f));;
|
filler.addAction(Actions.sizeTo(getWidth(), MathUtils.round((health/maxHealth)*getHeight()), 0.1f));;
|
||||||
@ -49,4 +49,8 @@ public class HealthBar extends WidgetGroup {
|
|||||||
empty.setHeight(height);
|
empty.setHeight(height);
|
||||||
super.setHeight(height);
|
super.setHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getMaxHealth() {
|
||||||
|
return maxHealth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.screens.CreativeDebugScreen;
|
import zero1hd.rhythmbullet.screens.CreativeScreen;
|
||||||
import zero1hd.rhythmbullet.screens.MainMenu;
|
import zero1hd.rhythmbullet.screens.MainMenu;
|
||||||
|
|
||||||
public class OptionsPage extends Page {
|
public class OptionsPage extends Page {
|
||||||
@ -152,7 +152,7 @@ public class OptionsPage extends Page {
|
|||||||
if (core.getAssetManager().update() && goToScreen != 0) {
|
if (core.getAssetManager().update() && goToScreen != 0) {
|
||||||
switch (goToScreen) {
|
switch (goToScreen) {
|
||||||
case 1:
|
case 1:
|
||||||
core.setScreen(new CreativeDebugScreen(core, (MainMenu) core.getScreen()));
|
core.setScreen(new CreativeScreen(core, (MainMenu) core.getScreen()));
|
||||||
}
|
}
|
||||||
goToScreen = 0;
|
goToScreen = 0;
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,14 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.em, gpa.cm, gpa);
|
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.em, gpa.cm, gpa);
|
||||||
diffWindow = new DifficultyWindow(core.getDefaultSkin());
|
diffWindow = new DifficultyWindow(core.getDefaultSkin());
|
||||||
|
|
||||||
|
toolbox = new Window("Tools", core.getDefaultSkin(), "tinted");
|
||||||
|
toolbox.defaults().pad(5f);
|
||||||
|
|
||||||
|
Table toolboxToolSet = new Table(core.getDefaultSkin());
|
||||||
|
toolboxToolSet.defaults().space(5f).left();
|
||||||
|
|
||||||
//Back button
|
//Back button
|
||||||
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
TextButton backButton = new TextButton("Back", core.getDefaultSkin(), "window");
|
||||||
backButton.addListener(new ChangeListener() {
|
backButton.addListener(new ChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,16 +75,9 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
core.setScreen(mainMenu);
|
core.setScreen(mainMenu);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
backButton.setPosition(10, Gdx.graphics.getHeight()-backButton.getHeight()-10);
|
toolboxToolSet.add(backButton);
|
||||||
addActor(backButton);
|
toolboxToolSet.row();
|
||||||
|
|
||||||
|
|
||||||
toolbox = new Window("Tools", core.getDefaultSkin(), "tinted");
|
|
||||||
toolbox.defaults().pad(5f);
|
|
||||||
|
|
||||||
Table toolboxToolSet = new Table(core.getDefaultSkin());
|
|
||||||
toolboxToolSet.defaults().space(5f);
|
|
||||||
|
|
||||||
final CheckBox musicSelectorCheckbox = new CheckBox(" Music selector", core.getDefaultSkin());
|
final CheckBox musicSelectorCheckbox = new CheckBox(" Music selector", core.getDefaultSkin());
|
||||||
musicSelectorCheckbox.addListener(new ChangeListener() {
|
musicSelectorCheckbox.addListener(new ChangeListener() {
|
||||||
|
|
||||||
@ -200,8 +199,7 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
toolboxToolSet.add(diffAdjusterCheckBox);
|
toolboxToolSet.add(diffAdjusterCheckBox);
|
||||||
|
|
||||||
ScrollPane scroller = new ScrollPane(toolboxToolSet, core.getDefaultSkin());
|
ScrollPane scroller = new ScrollPane(toolboxToolSet, core.getDefaultSkin());
|
||||||
toolbox.add(scroller).expand().fill();
|
toolbox.add(scroller).height(250f).width(150f);
|
||||||
toolbox.setSize(300, 300);
|
|
||||||
addActor(toolbox);
|
addActor(toolbox);
|
||||||
|
|
||||||
addListener(new InputListener() {
|
addListener(new InputListener() {
|
||||||
@ -213,7 +211,6 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
return super.keyUp(event, keycode);
|
return super.keyUp(event, keycode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolboxToolSet.pack();
|
|
||||||
toolbox.pack();
|
toolbox.pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import zero1hd.rhythmbullet.ui.windows.FPSWindow;
|
|||||||
import zero1hd.rhythmbullet.ui.windows.PauseMenu;
|
import zero1hd.rhythmbullet.ui.windows.PauseMenu;
|
||||||
|
|
||||||
public class GameHUD extends Stage {
|
public class GameHUD extends Stage {
|
||||||
private Label score;
|
private Label scoreLabel;
|
||||||
private ImageButton pause;
|
private ImageButton pause;
|
||||||
private boolean paused;
|
private boolean paused;
|
||||||
private FPSWindow fpsWindow;
|
private FPSWindow fpsWindow;
|
||||||
@ -25,11 +25,11 @@ public class GameHUD extends Stage {
|
|||||||
|
|
||||||
private Music music;
|
private Music music;
|
||||||
|
|
||||||
public GameHUD(Skin skin, int maxHealth) {
|
public GameHUD(Skin skin, float maxHealth) {
|
||||||
super();
|
super();
|
||||||
score = new Label("Score: 0", skin, "default-font", Color.WHITE);
|
scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE);
|
||||||
score.setPosition(10f, Gdx.graphics.getHeight()-score.getHeight() - 10f);
|
scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f);
|
||||||
addActor(score);
|
addActor(scoreLabel);
|
||||||
|
|
||||||
pause = new ImageButton(skin.getDrawable("pause"),
|
pause = new ImageButton(skin.getDrawable("pause"),
|
||||||
skin.getDrawable("pause-down"));
|
skin.getDrawable("pause-down"));
|
||||||
@ -67,15 +67,7 @@ public class GameHUD extends Stage {
|
|||||||
* @param score designated score
|
* @param score designated score
|
||||||
*/
|
*/
|
||||||
public void setScore(int score) {
|
public void setScore(int score) {
|
||||||
this.score.setText("Score: " + score);
|
this.scoreLabel.setText("Score: " + score);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns current score by use of substring
|
|
||||||
* @return the current score value
|
|
||||||
*/
|
|
||||||
public int getScore() {
|
|
||||||
return Integer.valueOf(score.getText().substring(7));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPaused(boolean paused) {
|
public void setPaused(boolean paused) {
|
||||||
@ -128,4 +120,8 @@ public class GameHUD extends Stage {
|
|||||||
public void setMusic(Music music) {
|
public void setMusic(Music music) {
|
||||||
this.music = music;
|
this.music = music;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HealthBar getHealthBar() {
|
||||||
|
return healthBar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ public class GamePlayArea extends Stage {
|
|||||||
public PolyJetEntity polyjet;
|
public PolyJetEntity polyjet;
|
||||||
private GamePlayMap audioMap;
|
private GamePlayMap audioMap;
|
||||||
|
|
||||||
|
private GameHUD gameHUD;
|
||||||
|
|
||||||
public CoordinatorManager cm;
|
public CoordinatorManager cm;
|
||||||
public EntityManager em;
|
public EntityManager em;
|
||||||
private CollisionDetector collisionDetector;
|
private CollisionDetector collisionDetector;
|
||||||
|
|
||||||
private int maxHealth = 100;
|
|
||||||
|
|
||||||
private float yTeleport = RhythmBullet.GAME_AREA_HEIGHT/2;
|
private float yTeleport = RhythmBullet.GAME_AREA_HEIGHT/2;
|
||||||
|
|
||||||
private int score;
|
private int score;
|
||||||
@ -43,13 +43,15 @@ public class GamePlayArea extends Stage {
|
|||||||
TextureRegion fboRegion;
|
TextureRegion fboRegion;
|
||||||
private int fboSize;
|
private int fboSize;
|
||||||
|
|
||||||
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
public GamePlayArea(AssetManager assetManager, Preferences prefs, GameHUD gameHUD) {
|
||||||
super(new FitViewport(RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT));
|
super(new FitViewport(RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT));
|
||||||
Gdx.app.debug("Game Area", "new area created");
|
Gdx.app.debug("Game Area", "new area created");
|
||||||
|
|
||||||
polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard");
|
polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard", gameHUD.getHealthBar());
|
||||||
em = new EntityManager(assetManager, prefs, this);
|
em = new EntityManager(assetManager, prefs, this);
|
||||||
cm = new CoordinatorManager(em);
|
cm = new CoordinatorManager(em);
|
||||||
|
this.gameHUD = gameHUD;
|
||||||
|
|
||||||
collisionDetector = new CollisionDetector(em.activeEnemies, em.activeAllies, assetManager, prefs);
|
collisionDetector = new CollisionDetector(em.activeEnemies, em.activeAllies, assetManager, prefs);
|
||||||
em.activeAllies.add(polyjet);
|
em.activeAllies.add(polyjet);
|
||||||
addActor(polyjet);
|
addActor(polyjet);
|
||||||
@ -141,6 +143,7 @@ public class GamePlayArea extends Stage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
collisionDetector.collisionCheck();
|
collisionDetector.collisionCheck();
|
||||||
|
addScore(collisionDetector.getAmassedPoints());
|
||||||
|
|
||||||
if (polyjet.getX() <= 1) {
|
if (polyjet.getX() <= 1) {
|
||||||
polyjet.moveLeft = false;
|
polyjet.moveLeft = false;
|
||||||
@ -165,11 +168,7 @@ public class GamePlayArea extends Stage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addScore (int score) {
|
public void addScore (int score) {
|
||||||
this.score += score;
|
setScore(this.score += score);
|
||||||
polyjet.health += score;
|
|
||||||
if (polyjet.health > maxHealth) {
|
|
||||||
polyjet.health = maxHealth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -226,13 +225,11 @@ public class GamePlayArea extends Stage {
|
|||||||
return polyjet;
|
return polyjet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getScore() {
|
public void setScore(int score) {
|
||||||
return score;
|
this.score = score;
|
||||||
|
gameHUD.setScore(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxHealth() {
|
|
||||||
return maxHealth;
|
|
||||||
}
|
|
||||||
public float getyTeleport() {
|
public float getyTeleport() {
|
||||||
return yTeleport;
|
return yTeleport;
|
||||||
}
|
}
|
||||||
|