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) != 0) {
|
||||||
if (umPeaks.get(index) >= avgUM) {
|
if (umPeaks.get(index) >= avgUM*1.75f) {
|
||||||
//If upper midrange peaks are greater than average, the:
|
//If upper midrange peaks are greater than average, the:
|
||||||
int spawnLocations = (RhythmBullet.GAME_AREA_WIDTH-8)/8;
|
esi = map.addEntity(em.flake, null);
|
||||||
|
|
||||||
esi = map.addEntity(em.bar, null);
|
float xSpawn = (rand.nextFloat()*RhythmBullet.GAME_AREA_WIDTH) < RhythmBullet.GAME_AREA_WIDTH/2f ? 0 : RhythmBullet.GAME_AREA_WIDTH;
|
||||||
esi.parameters.put("x", (float) (MathUtils.round(rand.nextFloat()*spawnLocations)*8));
|
float ySpawn = (rand.nextFloat()*RhythmBullet.GAME_AREA_HEIGHT < RhythmBullet.GAME_AREA_HEIGHT/2f ? 0 : RhythmBullet.GAME_AREA_HEIGHT);
|
||||||
esi.parameters.put("rate", (8f/avgSPB)*speedMod);
|
|
||||||
|
|
||||||
|
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 {
|
} else {
|
||||||
float xSpawnLocation = (rand.nextFloat()*(RhythmBullet.GAME_AREA_WIDTH-2))+1;
|
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("x", xSpawnLocation);
|
||||||
esi.parameters.put("y", RhythmBullet.GAME_AREA_HEIGHT-0.25f);
|
esi.parameters.put("y", RhythmBullet.GAME_AREA_HEIGHT-0.25f);
|
||||||
esi.parameters.put("angle", 140*rand.nextFloat()+200f);
|
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);
|
coordinator.setEntity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void kill() {
|
||||||
|
dead = true;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPoints() {
|
public int getPoints() {
|
||||||
return points + (coordinator != null ? coordinator.getScoreBonus() : 0);
|
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 com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.entity.ally.Laser;
|
import zero1hd.rhythmbullet.entity.ally.Laser;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Bar;
|
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
||||||
@ -23,7 +22,6 @@ public class EntityManager {
|
|||||||
public EntityFrame<VoidCircle> voidCircle;
|
public EntityFrame<VoidCircle> voidCircle;
|
||||||
public EntityFrame<Pellet> pellet;
|
public EntityFrame<Pellet> pellet;
|
||||||
public EntityFrame<Shard> shard;
|
public EntityFrame<Shard> shard;
|
||||||
public EntityFrame<Bar> bar;
|
|
||||||
public EntityFrame<Flake> flake;
|
public EntityFrame<Flake> flake;
|
||||||
|
|
||||||
public EntityFrame<Laser> laser;
|
public EntityFrame<Laser> laser;
|
||||||
@ -42,7 +40,6 @@ public class EntityManager {
|
|||||||
voidCircle = new EntityFrame<>(this, VoidCircle.class);
|
voidCircle = new EntityFrame<>(this, VoidCircle.class);
|
||||||
pellet = new EntityFrame<>(this, Pellet.class);
|
pellet = new EntityFrame<>(this, Pellet.class);
|
||||||
shard = new EntityFrame<>(this, Shard.class);
|
shard = new EntityFrame<>(this, Shard.class);
|
||||||
bar = new EntityFrame<>(this, Bar.class);
|
|
||||||
flake = new EntityFrame<>(this, Flake.class);
|
flake = new EntityFrame<>(this, Flake.class);
|
||||||
laser = new EntityFrame<>(this, Laser.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()];
|
this.shards = new Shard[params.get("shardCount").intValue()];
|
||||||
for (int i = 0; i < shards.length; i++) {
|
for (int i = 0; i < shards.length; i++) {
|
||||||
shards[i] = ec.shard.buildEntity();
|
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]);
|
ec.getStage().addActor(shards[i]);
|
||||||
}
|
}
|
||||||
this.speed = params.get("rate");
|
this.speed = params.get("rate");
|
||||||
@ -75,7 +75,7 @@ public class Flake extends Entity {
|
|||||||
|
|
||||||
if (timer <= 0) {
|
if (timer <= 0) {
|
||||||
for (int i = 0; i < shards.length; i++) {
|
for (int i = 0; i < shards.length; i++) {
|
||||||
shards[i].setSpeed(45f);
|
shards[i].setSpeed(30f);
|
||||||
}
|
}
|
||||||
dead = true;
|
dead = true;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,10 @@ public class Flake extends Entity {
|
|||||||
@Override
|
@Override
|
||||||
public void collided(Entity entity) {
|
public void collided(Entity entity) {
|
||||||
if (entity.getClass() == Laser.class) {
|
if (entity.getClass() == Laser.class) {
|
||||||
timer --;
|
dead = true;
|
||||||
|
for (int i = 0; i < shards.length; i++) {
|
||||||
|
shards[i].kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,10 @@ public class VoidCircle extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collided(Entity entity) {
|
public void collided(Entity entity) {
|
||||||
|
if (begin) {
|
||||||
sound.play(prefs.getFloat("fx vol"));
|
sound.play(prefs.getFloat("fx vol"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playCollidePFX() {
|
public boolean playCollidePFX() {
|
||||||
|
@ -27,7 +27,7 @@ public class CreativeScreen extends ScreenAdapter {
|
|||||||
public CreativeScreen(RhythmBullet core, MainMenu mainMenu) {
|
public CreativeScreen(RhythmBullet core, MainMenu mainMenu) {
|
||||||
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs());
|
||||||
ghud = new GameHUD(core.getDefaultSkin(), 100f, gamePlayArea);
|
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);
|
inputs = new InputMultiplexer(chud, ghud, gamePlayArea);
|
||||||
|
|
||||||
this.prefs = core.getPrefs();
|
this.prefs = core.getPrefs();
|
||||||
|
@ -45,8 +45,11 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
Window toolbox;
|
Window toolbox;
|
||||||
|
|
||||||
GamePlayArea gpa;
|
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.gpa = gpa;
|
||||||
|
this.ghud = ghud;
|
||||||
|
|
||||||
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
|
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
|
||||||
musicSelector.miniSender.addListener(this);
|
musicSelector.miniSender.addListener(this);
|
||||||
musicSelector.refresh();
|
musicSelector.refresh();
|
||||||
@ -263,6 +266,7 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
musicPlayBackControls.setAudiofile(analyzer.getAudioData());
|
musicPlayBackControls.setAudiofile(analyzer.getAudioData());
|
||||||
volumeWindow.setMusic(analyzer.getAudioData());
|
volumeWindow.setMusic(analyzer.getAudioData());
|
||||||
beatViewer.setMusic(analyzer.getAudioData(), analyzer);
|
beatViewer.setMusic(analyzer.getAudioData(), analyzer);
|
||||||
|
ghud.setMusic(null);
|
||||||
|
|
||||||
bassUMgraphWindow.setData(analyzer.getBassPeaks(), analyzer.getUMPeaks(), analyzer.getAudioData());
|
bassUMgraphWindow.setData(analyzer.getBassPeaks(), analyzer.getUMPeaks(), analyzer.getAudioData());
|
||||||
bassUMgraphWindow.getGraph().avgG1 = analyzer.getBassAvg();
|
bassUMgraphWindow.getGraph().avgG1 = analyzer.getBassAvg();
|
||||||
@ -274,6 +278,7 @@ public class CreativeHUD extends Stage implements MiniListener {
|
|||||||
mGraphWindow.getGraph().normalDataG1 = analyzer.getmMaxValue();
|
mGraphWindow.getGraph().normalDataG1 = analyzer.getmMaxValue();
|
||||||
mGraphWindow.getGraph().avgG1 = analyzer.getmAvg();
|
mGraphWindow.getGraph().avgG1 = analyzer.getmAvg();
|
||||||
gpa.setAudioMap(mapGen.getMap());
|
gpa.setAudioMap(mapGen.getMap());
|
||||||
|
ghud.setMusic(analyzer.getAudioData().getPlaybackMusic());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -57,8 +57,12 @@ public class MusicController extends Window {
|
|||||||
togglePlay.setDrawable(skin.getDrawable("arrow"));
|
togglePlay.setDrawable(skin.getDrawable("arrow"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
togglePlay.setDrawable(skin.getDrawable("pause"));
|
togglePlay.setDrawable(skin.getDrawable("pause"));
|
||||||
audiofile.getPlaybackMusic().play();
|
audiofile.getPlaybackMusic().play();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.clicked(event, x, y);
|
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.Coordinator;
|
||||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Bar;
|
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
||||||
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
||||||
@ -54,7 +53,6 @@ public class SpawnerWindow extends Window {
|
|||||||
add(mod1, mod2, mod3, mod4);
|
add(mod1, mod2, mod3, mod4);
|
||||||
|
|
||||||
listOfEntities = new List<>(skin);
|
listOfEntities = new List<>(skin);
|
||||||
entityFrames.add(em.bar);
|
|
||||||
entityFrames.add(em.flake);
|
entityFrames.add(em.flake);
|
||||||
entityFrames.add(em.laser);
|
entityFrames.add(em.laser);
|
||||||
entityFrames.add(em.pellet);
|
entityFrames.add(em.pellet);
|
||||||
@ -109,9 +107,6 @@ public class SpawnerWindow extends Window {
|
|||||||
} else if (entity.getClass() == Shard.class) {
|
} else if (entity.getClass() == Shard.class) {
|
||||||
Shard shard = (Shard) entity;
|
Shard shard = (Shard) entity;
|
||||||
shard.init(coords.x, coords.y, mod2.getValue()/mod2.getMaxValue()*360f, mod1.getValue(), (int) mod3.getValue());
|
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) {
|
} else if (entity.getClass() == Flake.class) {
|
||||||
Flake flake = (Flake) entity;
|
Flake flake = (Flake) entity;
|
||||||
flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, (int) mod4.getValue());
|
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