Permalink
Browse files

Cleaned up leakage and general warnings.

Unused variables gone and memory leakage cleared. Unused imports as
well.
  • Loading branch information...
1 parent 048fc14 commit ffd85000ef96cb951d9fed4a413920a9542f6825 @SubSage committed Mar 13, 2013
@@ -7,15 +7,15 @@
public class Bullet extends Entity
{
- private float damage, lastX, lastY, xVel, yVel;
+ private float damage, xVel, yVel;
private int width, height, alliance;
private Image bullet;
public Bullet(EntityManager manager, int xpos, int ypos, int dmg, int alnc)
{
super(manager);
- x=xpos;lastX=x;
- y=ypos;lastY=y;
+ x=xpos;
+ y=ypos;
width=9;
height=5;
damage=dmg;
@@ -37,8 +37,6 @@ public Bullet(EntityManager manager, int xpos, int ypos, int dmg, int alnc)
public void update(float delta)
{
- lastX = x;
- lastY = y;
x+= xVel * delta / 1000;
y+= yVel * delta / 1000;
@@ -1,6 +1,5 @@
package org.gdc.gdcalaga;
import java.util.*;
-import java.lang.*;
import java.io.*;
import java.lang.reflect.*;
import com.google.gson.Gson;
@@ -37,6 +36,7 @@ public void loadFromJson(String path){
while((line = read.readLine()) != null){
buffer += line + "\n";
}
+ read.close();
} catch(Exception e){
throw new RuntimeException(e);
}
@@ -13,22 +13,17 @@
public class Spawn
{
- private static int numberOfEnemies=1;
private static int wave=0;
public static void spawnWave(PathRegistry paths, EntityManager mng) {
- int countOfEnemies=0;
int countWaves = 0;
ArrayList<Entity> ents = mng.getEntities();
for(Entity e : ents)
{
- if(e instanceof Enemy)
- {
- countOfEnemies++;
- }
+
if(e instanceof Wave){
countWaves++;
}
@@ -1,5 +1,4 @@
package org.gdc.gdcalaga;
-import java.lang.*;
import java.util.*;
import org.newdawn.slick.Graphics;
@@ -71,7 +70,7 @@ private void spawnEnemy(){
if(type == "block"){
float newX = curX * 400 / xCols;
float newY = curY * 620 / yRows;
- Enemy newEnemy = new Enemy2(entities, newX, newY);
+ Enemy newEnemy = new Enemy(entities, newX, newY);
newEnemy.setGroup(group, newX, newY);
newEnemy.setPath(path.copy(x + newX, y + newY));
curY++;

0 comments on commit ffd8500

Please sign in to comment.