gradients for sides better implemented
This commit is contained in:
parent
85117f74aa
commit
aad923ea48
@ -318,11 +318,4 @@ large-pane
|
||||
split: 4, 4, 13, 13
|
||||
orig: 9, 27
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
gradient-bar
|
||||
rotate: false
|
||||
xy: 26, 7
|
||||
size: 3, 1
|
||||
orig: 3, 1
|
||||
offset: 0, 0
|
||||
index: -1
|
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 5.4 KiB |
@ -74,6 +74,26 @@ public class PolyjetEntity extends Entity {
|
||||
health = maxH;
|
||||
}
|
||||
|
||||
if (getX() <= 1) {
|
||||
moveLeft = false;
|
||||
setX(1f);
|
||||
}
|
||||
|
||||
if (getX() >= RhythmBullet.GAME_AREA_WIDTH-1-getWidth()) {
|
||||
moveRight = false;
|
||||
setX(RhythmBullet.GAME_AREA_WIDTH-1f-getWidth());
|
||||
}
|
||||
|
||||
if (getY() >= RhythmBullet.GAME_AREA_HEIGHT - 1 - getHeight()) {
|
||||
moveUp = false;
|
||||
setY(RhythmBullet.GAME_AREA_HEIGHT - 1 - getHeight());
|
||||
}
|
||||
|
||||
if (getY() <= 1) {
|
||||
moveDown = false;
|
||||
setY(1f);
|
||||
}
|
||||
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class CreativeScreen extends ScreenAdapter {
|
||||
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
||||
ghud = new GameHUD(core.getDefaultSkin(), 100f, gamePlayArea);
|
||||
chud = new CreativeHUD(core, mainMenu, gamePlayArea);
|
||||
inputs = new InputMultiplexer(chud, gamePlayArea);
|
||||
inputs = new InputMultiplexer(chud, ghud, gamePlayArea);
|
||||
|
||||
this.prefs = core.getPrefs();
|
||||
|
||||
|
@ -4,6 +4,10 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.audio.Music;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
@ -24,6 +28,9 @@ public class GameHUD extends Stage {
|
||||
private FPSWindow fpsWindow;
|
||||
private PauseMenu pauseMenu;
|
||||
private HealthBar healthBar;
|
||||
private Pixmap pixmap;
|
||||
private Texture leftStatTexture;
|
||||
private Texture rightStatTexture;
|
||||
private Image leftStatusBar;
|
||||
private Image rightStatusBar;
|
||||
private Music music;
|
||||
@ -61,21 +68,40 @@ public class GameHUD extends Stage {
|
||||
healthBar = new HealthBar(skin, maxHealth);
|
||||
healthBar.setSize(30f, Gdx.graphics.getHeight()/3);
|
||||
healthBar.setHealth(maxHealth);
|
||||
healthBar.setPosition(Gdx.graphics.getWidth()-healthBar.getWidth() -10f, (Gdx.graphics.getHeight()-healthBar.getHeight())/2f);
|
||||
healthBar.setPosition(Gdx.graphics.getWidth() -(gpa.getViewport().getRightGutterWidth()/4f), (Gdx.graphics.getHeight()-healthBar.getHeight())/2f);
|
||||
addActor(healthBar);
|
||||
healthBar.setPolyjetEntity(gpa.getPolyjetEntity());
|
||||
|
||||
leftStatusBar = new Image(skin.getDrawable("gradient-bar"));
|
||||
leftStatusBar.setSize(30f, getHeight());
|
||||
leftStatusBar.setPosition(gpa.getViewport().getScreenX()-leftStatusBar.getWidth()/2f, 0);
|
||||
|
||||
pixmap = new Pixmap(3, 3, Format.RGBA8888);
|
||||
int excess = 2*gpa.getViewport().getLeftGutterWidth()/pixmap.getWidth();
|
||||
Gdx.app.debug("GHUD", "offset on size: " + excess);
|
||||
pixmap.setColor(Color.WHITE);
|
||||
pixmap.drawLine(0, 0, 0, 2);
|
||||
pixmap.setColor(1f, 1f, 1f, 0.5f);
|
||||
pixmap.drawLine(1, 0, 1, 2);
|
||||
leftStatTexture = new Texture(pixmap);
|
||||
leftStatTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
leftStatusBar = new Image(leftStatTexture);
|
||||
leftStatusBar.setSize(gpa.getViewport().getLeftGutterWidth()+excess, getHeight());
|
||||
leftStatusBar.setPosition(0, 0);
|
||||
addActor(leftStatusBar);
|
||||
leftStatusBar.toBack();
|
||||
|
||||
rightStatusBar = new Image(skin.getDrawable("gradient-bar"));
|
||||
rightStatusBar.setSize(20f, getHeight());
|
||||
rightStatusBar.setPosition(gpa.getViewport().getScreenX()+gpa.getViewport().getScreenWidth()-rightStatusBar.getWidth()/2f, 0);
|
||||
pixmap.dispose();
|
||||
pixmap = new Pixmap(3, 3, Format.RGBA8888);
|
||||
pixmap.setColor(Color.WHITE);
|
||||
pixmap.drawLine(2, 0, 2, 2);
|
||||
pixmap.setColor(1f, 1f, 1f, 0.5f);
|
||||
pixmap.drawLine(1, 0, 1, 2);
|
||||
rightStatTexture = new Texture(pixmap);
|
||||
rightStatTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
rightStatusBar = new Image(rightStatTexture);
|
||||
rightStatusBar.setSize(gpa.getViewport().getRightGutterWidth()+excess, getHeight());
|
||||
rightStatusBar.setPosition(getWidth()-gpa.getViewport().getRightGutterWidth()-excess, 0f);
|
||||
addActor(rightStatusBar);
|
||||
|
||||
setStatusColor(1, 1, 1, 0.5f);
|
||||
rightStatusBar.toBack();
|
||||
pixmap.dispose();
|
||||
setStatusColor(0.0f, 1f, 1f, 0.7f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,10 +123,14 @@ public class GameHUD extends Stage {
|
||||
public void setPaused(boolean paused) {
|
||||
if (paused) {
|
||||
addActor(pauseMenu);
|
||||
music.pause();
|
||||
if (music != null) {
|
||||
music.pause();
|
||||
}
|
||||
} else {
|
||||
pauseMenu.remove();
|
||||
music.play();
|
||||
if (music != null) {
|
||||
music.play();
|
||||
}
|
||||
}
|
||||
this.paused = paused;
|
||||
}
|
||||
@ -161,4 +191,11 @@ public class GameHUD extends Stage {
|
||||
public HealthBar getHealthBar() {
|
||||
return healthBar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
leftStatTexture.dispose();
|
||||
rightStatTexture.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -141,25 +141,6 @@ public class GamePlayArea extends Stage {
|
||||
collisionDetector.collisionCheck();
|
||||
score.addScore(collisionDetector.getAmassedPoints());
|
||||
|
||||
if (polyjet.getX() <= 1) {
|
||||
polyjet.moveLeft = false;
|
||||
polyjet.setX(1f);
|
||||
}
|
||||
|
||||
if (polyjet.getX() >= RhythmBullet.GAME_AREA_WIDTH-1-polyjet.getWidth()) {
|
||||
polyjet.moveRight = false;
|
||||
polyjet.setX(RhythmBullet.GAME_AREA_WIDTH-1f-polyjet.getWidth());
|
||||
}
|
||||
|
||||
if (polyjet.getY() >= RhythmBullet.GAME_AREA_HEIGHT - 1 - polyjet.getHeight()) {
|
||||
polyjet.moveUp = false;
|
||||
polyjet.setY(RhythmBullet.GAME_AREA_HEIGHT - 1 - polyjet.getHeight());
|
||||
}
|
||||
|
||||
if (polyjet.getY() <= 1) {
|
||||
polyjet.moveDown = false;
|
||||
polyjet.setY(1f);
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user