From 8f0eedd1c5508433e3650633cb22795f88202e2e Mon Sep 17 00:00:00 2001 From: Recrown Date: Wed, 17 Jan 2018 23:07:07 -0600 Subject: [PATCH] added comments; removed collision detector vfx and sfx --- .../entity/CollisionDetector.java | 45 ------------------- .../zero1hd/rhythmbullet/entity/Entity.java | 8 ---- .../entity/coordinator/Coordinator.java | 5 +++ .../entity/coordinator/CoordinatorFrame.java | 6 +++ 4 files changed, 11 insertions(+), 53 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java b/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java index 1f70491..9bb4933 100755 --- a/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java +++ b/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java @@ -4,14 +4,8 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.audio.Sound; -import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.ParticleEffect; -import com.badlogic.gdx.graphics.g2d.ParticleEffectPool; -import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect; import com.badlogic.gdx.utils.Array; -import zero1hd.rhythmbullet.RhythmBullet; - public class CollisionDetector { Array enemies; Array allies; @@ -19,10 +13,6 @@ public class CollisionDetector { AssetManager assets; Preferences prefs; - //Particle pools; - ParticleEffectPool explosionEffectPool; - Array effects = new Array<>(); - private int amassedPoints; Sound explosionSFX; public CollisionDetector(Array enemies, Array allies, AssetManager assetManager, Preferences prefs) { @@ -31,8 +21,6 @@ public class CollisionDetector { assets = assetManager; this.prefs = prefs; - explosionEffectPool = new ParticleEffectPool(assets.get("explosion-s.p", ParticleEffect.class), 1, 64); - explosionSFX = assets.get("explosion.ogg", Sound.class); } public void collisionCheck() { @@ -46,17 +34,6 @@ public class CollisionDetector { if (enemy.getHitZone().overlaps(ally.getHitZone())) { Gdx.app.debug("Collision Detector", "Collision between entities: " + enemy.getClass().getSimpleName() + " and " + ally.getClass().getSimpleName()); - //Play FX; - if (ally.playCollideSFX() && enemy.playCollideSFX()) { - explosionSFX.play(prefs.getFloat("fx vol")/100f, 1f, (enemy.getX()/RhythmBullet.GAME_AREA_WIDTH)); - } - if (ally.playCollidePFX() && enemy.playCollidePFX()) { - PooledEffect currentPFX; - currentPFX = explosionEffectPool.obtain(); - currentPFX.setPosition(ally.getX() + ally.getWidth()/2f, ally.getY() + ally.getHeight()/2f); - effects.add(currentPFX); - } - enemy.collided(ally); ally.collided(enemy); @@ -71,28 +48,6 @@ public class CollisionDetector { } - /** - * draws the explosion particles where necessary. - * @param batch the batch used to draw the said particles - * @param cleanBatch whether this method should call begin and end on the batch. - */ - public void renderParticles(Batch batch, float delta, boolean cleanBatch) { - if (cleanBatch) { - batch.begin(); - } - for (int i = 0; i < effects.size; i++) { - effects.get(i).draw(batch, delta); - if (effects.get(i).isComplete()) { - effects.get(i).free(); - effects.removeIndex(i); - } - } - - if (cleanBatch) { - batch.end(); - } - } - public int getAmassedPoints() { int amassedPoints = this.amassedPoints; this.amassedPoints = 0; diff --git a/core/src/zero1hd/rhythmbullet/entity/Entity.java b/core/src/zero1hd/rhythmbullet/entity/Entity.java index 82f98bc..dd27141 100755 --- a/core/src/zero1hd/rhythmbullet/entity/Entity.java +++ b/core/src/zero1hd/rhythmbullet/entity/Entity.java @@ -125,14 +125,6 @@ public class Entity extends Actor implements Poolable { super.draw(batch, parentAlpha); } - public boolean playCollidePFX() { - return true; - } - - public boolean playCollideSFX() { - return true; - } - public void move(float delta, boolean update) { rotRatios.set(MathUtils.cosDeg(angle), MathUtils.sinDeg(angle)); moveBy(rotRatios.x*speed*delta, rotRatios.y*speed*delta); diff --git a/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java index f048447..78bef87 100755 --- a/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java @@ -5,6 +5,11 @@ import com.badlogic.gdx.utils.Pool.Poolable; import zero1hd.rhythmbullet.entity.Entity; import zero1hd.rhythmbullet.entity.EntityManager; +/** + * Coordinator coordinates movement of an entity. Movement can range from basic pre-determined to more advanced (with condition based behavior). + * @author Yunyang + * + */ public class Coordinator implements Poolable { private CoordinatorFrame cf; protected EntityManager em; diff --git a/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java index e1e8531..439c5f6 100755 --- a/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java @@ -9,6 +9,12 @@ public class CoordinatorFrame { private EntityManager em; CoordinatorFrame cf; Class coordinatorType; + + /** + * Similar to an entityFrame, however this time, for a coordinator. + * @param entityManager + * @param classtype + */ public CoordinatorFrame(EntityManager entityManager, Class classtype) { this.em = entityManager; coordinatorType = classtype;