fixed minor resize bug on pre game screen and made small design changes to entities
This commit is contained in:
parent
2cd752f25c
commit
44551bdea3
@ -78,11 +78,12 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
map.addNullToMap();
|
||||
}
|
||||
|
||||
progress = (int) (100f*index/bassPeaks.size);
|
||||
progress = MathUtils.round(100f*index/bassPeaks.size);
|
||||
|
||||
sender.send(MiniEvents.MAPGEN_ITERATED);
|
||||
}
|
||||
map.endBuild();
|
||||
sender.send(MiniEvents.MAP_GENERATED);
|
||||
}
|
||||
|
||||
public synchronized GamePlayMap getMap() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package zero1hd.polyjet.entity.enemies;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
@ -16,6 +17,7 @@ public class Flake extends Actor implements Poolable, Entity {
|
||||
private Texture texture;
|
||||
private float rate;
|
||||
private float timer;
|
||||
private float totalTime;
|
||||
private Shard[] shards;
|
||||
private Rectangle hitbox;
|
||||
private Vector2 center;
|
||||
@ -33,6 +35,7 @@ public class Flake extends Actor implements Poolable, Entity {
|
||||
setSize(3f, 3f);
|
||||
this.rate = rate;
|
||||
this.timer = fuse;
|
||||
this.totalTime = fuse;
|
||||
hitbox.setSize(getWidth(), getHeight());
|
||||
center.set(getWidth()/2f, getHeight()/2f);
|
||||
setPosition(x-center.x, y-center.y);
|
||||
@ -59,12 +62,21 @@ public class Flake extends Actor implements Poolable, Entity {
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
batch.setColor(0.25f,0.25f,0.25f,1f- timer/totalTime);
|
||||
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
|
||||
batch.setColor(Color.WHITE);
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
switch (entity.getEntityType()) {
|
||||
case LASER:
|
||||
timer --;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,6 +111,7 @@ public class Flake extends Actor implements Poolable, Entity {
|
||||
setSize(0, 0);
|
||||
center.set(0, 0);
|
||||
rot.set(0, 0);
|
||||
totalTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class Shard extends Actor implements Entity, Poolable {
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
sprite.setCenter(getX()+center.x, getY()+center.y);
|
||||
sprite.setColor(1.3f-((float)hp/(float)maxHp), 1.3f-((float)hp/(float)maxHp), 1.3f-((float)hp/(float)maxHp), 0.75f);
|
||||
sprite.setColor(((float)hp/(float)maxHp), ((float)hp/(float)maxHp), ((float)hp/(float)maxHp), 0.5f);
|
||||
sprite.draw(batch);
|
||||
batch.setColor(Color.WHITE);
|
||||
super.draw(batch, parentAlpha);
|
||||
|
@ -78,6 +78,8 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
||||
|
||||
@Override
|
||||
public Screen postTransition() {
|
||||
stage.clear();
|
||||
|
||||
ms = new MusicSelectionPage(core);
|
||||
ms.miniSender.addListener(this);
|
||||
ms.beginMusicSearch();
|
||||
|
@ -29,6 +29,9 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
AudioData music;
|
||||
RhythmMapAlgorithm mapGenAlgorithm;
|
||||
|
||||
private Table songInfo;
|
||||
private volatile Label[] info;
|
||||
|
||||
Table difficultyTable;
|
||||
private Label diffTitle;
|
||||
private Slider sensitivityRating;
|
||||
@ -41,18 +44,25 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
private boolean confirmed;
|
||||
private Skin skin;
|
||||
|
||||
private Table beginTable;
|
||||
private TextButton beginButton;
|
||||
|
||||
private TextButton back;
|
||||
private Image loadingCircle;
|
||||
private long startTime, endTime;
|
||||
|
||||
Table songInfo;
|
||||
private Label[] info;
|
||||
private Thread mapGenThread;
|
||||
|
||||
public AnalyzePage(Skin skin, AssetManager assets) {
|
||||
super("Results", skin);
|
||||
this.skin = skin;
|
||||
|
||||
songInfo = new Table(skin);
|
||||
songInfo.align(Align.top);
|
||||
songInfo.pad(15f);
|
||||
songInfo.setBackground(skin.getDrawable("large-pane"));
|
||||
addActor(songInfo);
|
||||
|
||||
difficultyTable = new Table(skin);
|
||||
difficultyTable.setBackground(skin.getDrawable("large-pane"));
|
||||
addActor(difficultyTable);
|
||||
@ -118,6 +128,10 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
info[2].setText("Confirmed.");
|
||||
confirmed = true;
|
||||
confirmDiffButton.setDisabled(true);
|
||||
sensitivityRating.setDisabled(true);
|
||||
speedModifier.setDisabled(true);
|
||||
healthModifier.setDisabled(true);
|
||||
|
||||
if (audioAnalyzer.containsData() ) {
|
||||
finalizeData();
|
||||
}
|
||||
@ -127,10 +141,14 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
|
||||
difficultyTable.pack();
|
||||
|
||||
songInfo = new Table(skin);
|
||||
songInfo.setBackground(skin.getDrawable("large-pane"));
|
||||
addActor(songInfo);
|
||||
|
||||
beginTable = new Table(skin);
|
||||
beginTable.pad(15f);
|
||||
beginButton = new TextButton("Begin!", skin);
|
||||
beginTable.add(beginButton);
|
||||
beginTable.setBackground(skin.getDrawable("large-pane"));
|
||||
beginTable.pack();
|
||||
addActor(beginTable);
|
||||
|
||||
loadingCircle = new Image(assets.get("cybercircle1.png", Texture.class));
|
||||
loadingCircle.setPosition((getWidth()-loadingCircle.getWidth())/2, (getHeightBelowTitle()-loadingCircle.getHeight())/2);
|
||||
loadingCircle.setColor(0.8f,0.8f,0.8f,0.7f);
|
||||
@ -145,7 +163,9 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
miniSender.send(MiniEvents.BACK);
|
||||
audioAnalyzer.stop();
|
||||
if (audioAnalyzer != null) {
|
||||
audioAnalyzer.stop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -158,9 +178,13 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
}
|
||||
|
||||
public void setSong(AudioData music, AudioInfo audioInfo, MiniListener listener) {
|
||||
confirmed = false;
|
||||
confirmDiffButton.setDisabled(false);
|
||||
sensitivityRating.setDisabled(false);
|
||||
speedModifier.setDisabled(false);
|
||||
healthModifier.setDisabled(false);
|
||||
|
||||
songInfo.clear();
|
||||
songInfo.align(Align.top);
|
||||
songInfo.pad(15f);
|
||||
songInfo.defaults().align(Align.left | Align.top);
|
||||
audioAnalyzer = new AudioAnalyzer();
|
||||
audioAnalyzer.sender.addListener(this);
|
||||
@ -182,6 +206,8 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
songInfo.setPosition((getWidth()-songInfo.getWidth())/2f, (getHeightBelowTitle()-songInfo.getHeight())/2f);
|
||||
difficultyTable.setPosition(songInfo.getX(), -difficultyTable.getHeight());
|
||||
difficultyTable.setWidth(songInfo.getWidth());
|
||||
beginTable.setPosition(difficultyTable.getX(), -beginTable.getHeight());
|
||||
beginTable.setWidth(difficultyTable.getWidth());
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
info[0].addAction(Actions.color(Color.BLACK, 2.5f));
|
||||
@ -236,12 +262,15 @@ public class AnalyzePage extends Page implements MiniListener {
|
||||
startTime = System.currentTimeMillis();
|
||||
break;
|
||||
case MAPGEN_ITERATED:
|
||||
info[4].setText("Generating map: " + mapGenAlgorithm.getProgress());
|
||||
info[4].setText("Generating map: " + mapGenAlgorithm.getProgress() + "%");
|
||||
break;
|
||||
case MAP_GENERATED:
|
||||
endTime = System.currentTimeMillis();
|
||||
info[5].setText("Done. Generation time: " + ((endTime - startTime)/1000f) + "s");
|
||||
info[5].addAction(Actions.color(Color.BLACK, 0.75f));
|
||||
songInfo.addAction(Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight(), 0.75f, Interpolation.linear));
|
||||
difficultyTable.addAction(Actions.sequence(Actions.delay(0.4f), Actions.moveTo(songInfo.getX(), getHeightBelowTitle()-songInfo.getHeight()-difficultyTable.getHeight()-10f,0.8f, Interpolation.linear)));
|
||||
beginTable.addAction(Actions.sequence(Actions.delay(0.5f), Actions.moveTo(difficultyTable.getX(), getHeightBelowTitle()-songInfo.getHeight()-difficultyTable.getHeight()-beginTable.getHeight()-20f,0.8f, Interpolation.linear)));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user