changed spawn algorithm to include flakes
This commit is contained in:
parent
c98407c516
commit
bed23303e4
@ -88,14 +88,31 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
}
|
||||
|
||||
if (umPeaks.get(index) != 0) {
|
||||
if (umPeaks.get(index) >= avgUM) {
|
||||
//If upper midrange peaks are greater than average, the:
|
||||
int spawnLocations = (RhythmBullet.GAME_AREA_WIDTH-8)/8;
|
||||
if (umPeaks.get(index) >= avgUM*1.75f) {
|
||||
//If upper midrange peaks are greater than average, the:
|
||||
esi = map.addEntity(em.flake, null);
|
||||
|
||||
esi = map.addEntity(em.bar, null);
|
||||
esi.parameters.put("x", (float) (MathUtils.round(rand.nextFloat()*spawnLocations)*8));
|
||||
esi.parameters.put("rate", (8f/avgSPB)*speedMod);
|
||||
float xSpawn = (rand.nextFloat()*RhythmBullet.GAME_AREA_WIDTH) < RhythmBullet.GAME_AREA_WIDTH/2f ? 0 : RhythmBullet.GAME_AREA_WIDTH;
|
||||
float ySpawn = (rand.nextFloat()*RhythmBullet.GAME_AREA_HEIGHT < RhythmBullet.GAME_AREA_HEIGHT/2f ? 0 : RhythmBullet.GAME_AREA_HEIGHT);
|
||||
|
||||
float angle = rand.nextFloat()*90;
|
||||
if (xSpawn == 0) {
|
||||
if (ySpawn != 0) {
|
||||
angle += 270;
|
||||
}
|
||||
} else {
|
||||
if (ySpawn == 0) {
|
||||
angle += 90;
|
||||
} else {
|
||||
angle += 180;
|
||||
}
|
||||
}
|
||||
esi.parameters.put("shardCount", (1f+(difficultyMod/100f))*4f);
|
||||
esi.parameters.put("x", xSpawn);
|
||||
esi.parameters.put("y", ySpawn);
|
||||
esi.parameters.put("rate", (5/avgSPB)*speedMod);
|
||||
esi.parameters.put("fuse", avgSPB*10f);
|
||||
esi.parameters.put("angle", angle);
|
||||
} else {
|
||||
float xSpawnLocation = (rand.nextFloat()*(RhythmBullet.GAME_AREA_WIDTH-2))+1;
|
||||
|
||||
@ -103,7 +120,7 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
esi.parameters.put("x", xSpawnLocation);
|
||||
esi.parameters.put("y", RhythmBullet.GAME_AREA_HEIGHT-0.25f);
|
||||
esi.parameters.put("angle", 140*rand.nextFloat()+200f);
|
||||
esi.parameters.put("speed", (RhythmBullet.GAME_AREA_HEIGHT/4f)/avgSPB);
|
||||
esi.parameters.put("speed", (RhythmBullet.GAME_AREA_HEIGHT/8f)/avgSPB);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +187,10 @@ public class Entity extends Actor implements Poolable {
|
||||
coordinator.setEntity(this);
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
dead = true;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points + (coordinator != null ? coordinator.getScoreBonus() : 0);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Bar;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
||||
@ -23,7 +22,6 @@ public class EntityManager {
|
||||
public EntityFrame<VoidCircle> voidCircle;
|
||||
public EntityFrame<Pellet> pellet;
|
||||
public EntityFrame<Shard> shard;
|
||||
public EntityFrame<Bar> bar;
|
||||
public EntityFrame<Flake> flake;
|
||||
|
||||
public EntityFrame<Laser> laser;
|
||||
@ -42,7 +40,6 @@ public class EntityManager {
|
||||
voidCircle = new EntityFrame<>(this, VoidCircle.class);
|
||||
pellet = new EntityFrame<>(this, Pellet.class);
|
||||
shard = new EntityFrame<>(this, Shard.class);
|
||||
bar = new EntityFrame<>(this, Bar.class);
|
||||
flake = new EntityFrame<>(this, Flake.class);
|
||||
laser = new EntityFrame<>(this, Laser.class);
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
package zero1hd.rhythmbullet.entity.enemies;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.entity.Entity;
|
||||
import zero1hd.rhythmbullet.entity.ally.PolyjetEntity;
|
||||
|
||||
public class Bar extends Entity {
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
setSize(8f, 0.5f);
|
||||
sprite = new Sprite(assets.get("bar.png", Texture.class));
|
||||
enemy = true;
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float x, float rate) {
|
||||
setPosition(x, RhythmBullet.GAME_AREA_HEIGHT);
|
||||
speed = rate;
|
||||
angle = 270;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
setPosition(params.get("x"), RhythmBullet.GAME_AREA_HEIGHT);
|
||||
speed = params.get("rate");
|
||||
angle = 270;
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
hitbox.setPosition(getX(), getY());
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getClass() == PolyjetEntity.class) {
|
||||
dead = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getHitZone() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
}
|
@ -49,7 +49,7 @@ public class Flake extends Entity {
|
||||
this.shards = new Shard[params.get("shardCount").intValue()];
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i] = ec.shard.buildEntity();
|
||||
shards[i].init(params.get("x"), params.get("y"), 360/shards.length*i, 0, 2);
|
||||
shards[i].init(params.get("x"), params.get("y"), 360/shards.length*i, 0, 1);
|
||||
ec.getStage().addActor(shards[i]);
|
||||
}
|
||||
this.speed = params.get("rate");
|
||||
@ -75,7 +75,7 @@ public class Flake extends Entity {
|
||||
|
||||
if (timer <= 0) {
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].setSpeed(45f);
|
||||
shards[i].setSpeed(30f);
|
||||
}
|
||||
dead = true;
|
||||
}
|
||||
@ -92,7 +92,10 @@ public class Flake extends Entity {
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getClass() == Laser.class) {
|
||||
timer --;
|
||||
dead = true;
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,9 @@ public class VoidCircle extends Entity {
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
sound.play(prefs.getFloat("fx vol"));
|
||||
if (begin) {
|
||||
sound.play(prefs.getFloat("fx vol"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,7 @@ public class CreativeScreen extends ScreenAdapter {
|
||||
public CreativeScreen(RhythmBullet core, MainMenu mainMenu) {
|
||||
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
||||
ghud = new GameHUD(core.getDefaultSkin(), 100f, gamePlayArea);
|
||||
chud = new CreativeHUD(core, mainMenu, gamePlayArea);
|
||||
chud = new CreativeHUD(core, mainMenu, gamePlayArea, ghud);
|
||||
inputs = new InputMultiplexer(chud, ghud, gamePlayArea);
|
||||
|
||||
this.prefs = core.getPrefs();
|
||||
|
@ -45,8 +45,11 @@ public class CreativeHUD extends Stage implements MiniListener {
|
||||
Window toolbox;
|
||||
|
||||
GamePlayArea gpa;
|
||||
public CreativeHUD(final RhythmBullet core, final MainMenu mainMenu, final GamePlayArea gpa) {
|
||||
GameHUD ghud;
|
||||
public CreativeHUD(final RhythmBullet core, final MainMenu mainMenu, final GamePlayArea gpa, GameHUD ghud) {
|
||||
this.gpa = gpa;
|
||||
this.ghud = ghud;
|
||||
|
||||
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
|
||||
musicSelector.miniSender.addListener(this);
|
||||
musicSelector.refresh();
|
||||
@ -263,7 +266,8 @@ public class CreativeHUD extends Stage implements MiniListener {
|
||||
musicPlayBackControls.setAudiofile(analyzer.getAudioData());
|
||||
volumeWindow.setMusic(analyzer.getAudioData());
|
||||
beatViewer.setMusic(analyzer.getAudioData(), analyzer);
|
||||
|
||||
ghud.setMusic(null);
|
||||
|
||||
bassUMgraphWindow.setData(analyzer.getBassPeaks(), analyzer.getUMPeaks(), analyzer.getAudioData());
|
||||
bassUMgraphWindow.getGraph().avgG1 = analyzer.getBassAvg();
|
||||
bassUMgraphWindow.getGraph().normalDataG1 = analyzer.getBassMaxValue();
|
||||
@ -274,6 +278,7 @@ public class CreativeHUD extends Stage implements MiniListener {
|
||||
mGraphWindow.getGraph().normalDataG1 = analyzer.getmMaxValue();
|
||||
mGraphWindow.getGraph().avgG1 = analyzer.getmAvg();
|
||||
gpa.setAudioMap(mapGen.getMap());
|
||||
ghud.setMusic(analyzer.getAudioData().getPlaybackMusic());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -57,8 +57,12 @@ public class MusicController extends Window {
|
||||
togglePlay.setDrawable(skin.getDrawable("arrow"));
|
||||
|
||||
} else {
|
||||
togglePlay.setDrawable(skin.getDrawable("pause"));
|
||||
audiofile.getPlaybackMusic().play();
|
||||
try {
|
||||
togglePlay.setDrawable(skin.getDrawable("pause"));
|
||||
audiofile.getPlaybackMusic().play();
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.clicked(event, x, y);
|
||||
|
@ -18,7 +18,6 @@ import zero1hd.rhythmbullet.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Bar;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
||||
@ -54,7 +53,6 @@ public class SpawnerWindow extends Window {
|
||||
add(mod1, mod2, mod3, mod4);
|
||||
|
||||
listOfEntities = new List<>(skin);
|
||||
entityFrames.add(em.bar);
|
||||
entityFrames.add(em.flake);
|
||||
entityFrames.add(em.laser);
|
||||
entityFrames.add(em.pellet);
|
||||
@ -109,9 +107,6 @@ public class SpawnerWindow extends Window {
|
||||
} else if (entity.getClass() == Shard.class) {
|
||||
Shard shard = (Shard) entity;
|
||||
shard.init(coords.x, coords.y, mod2.getValue()/mod2.getMaxValue()*360f, mod1.getValue(), (int) mod3.getValue());
|
||||
} else if (entity.getClass() == Bar.class) {
|
||||
Bar bar = (Bar) entity;
|
||||
bar.init(coords.x, mod1.getValue());
|
||||
} else if (entity.getClass() == Flake.class) {
|
||||
Flake flake = (Flake) entity;
|
||||
flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, (int) mod4.getValue());
|
||||
|
Loading…
Reference in New Issue
Block a user