Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
Removed an unnecessary instantiation, deleted an unused import, etc.
  • Loading branch information
guoguo12 committed Apr 8, 2013
1 parent 342ddd7 commit 2563fbc
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions GDCalaga/src/org/gdc/gdcalaga/Player.java
@@ -1,5 +1,4 @@
package org.gdc.gdcalaga;
import org.gdc.gdcalaga.Upgrade.UpgradeType;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
Expand Down Expand Up @@ -127,18 +126,13 @@ public boolean fire(float delta)
//TODO add more firing positions and more bullets depending on the upgrades
if (ticksSinceLastBullet >= ticksPerBullet)
{
int max = 0;
if (numGuns < gunPositions.getSize())
max = numGuns;
else
max = gunPositions.getSize();

for (int iii = 0; iii < max; iii++)
int max = numGuns < gunPositions.getSize() ? numGuns : gunPositions.getSize();
for (int i = 0; i < max; i++)
{
Vector2f position = new Vector2f(gunPositions.getPosition(iii));
Vector2f position = new Vector2f(gunPositions.getPosition(i));
position.add(pos);
Bullet newBullet = new Bullet(entities, position, (int)(damage), alliance);
Vector2f direction = new Vector2f(gunPositions.getDirection(iii));
Vector2f direction = gunPositions.getDirection(i);
newBullet.setSpeed(direction.x * 500, direction.y * 500);
}

Expand Down Expand Up @@ -216,10 +210,8 @@ public static void increaseTotalPoints(int pointValue)
//my idea here is that ship upgrades will cost points to buy, like in most games.
public static void decreaseTotalPoints(int pointValue)
{
if( (totalPoints - pointValue) >= 0)
{
if(totalPoints - pointValue >= 0)
totalPoints -= pointValue;
}
else
System.out.println("Can't spend any more points!"); //TODO Fix error message
}
Expand Down

0 comments on commit 2563fbc

Please sign in to comment.