Permalink
Browse files

Fixed which round game is in.

Round variable was ahead by one. Fixed. Added comment description to
Spawn, I'll get to it later if no one else does before I do.
  • Loading branch information...
1 parent 4339e43 commit 070a1d22114cc9773314a95e624c7ecff6c828d1 @SubSage committed Mar 8, 2013
Showing with 27 additions and 8 deletions.
  1. +5 −1 GDCalaga/src/org/gdc/gdcalaga/PlayState.java
  2. +22 −7 GDCalaga/src/org/gdc/gdcalaga/Spawn.java
@@ -41,14 +41,18 @@ public void render(GameContainer container, StateBasedGame game, Graphics g) thr
obj.draw(g);
}
entities.draw(g);
- g.drawString("Player HP: " + player.getHealth() + " Round " + Spawn.wave, 5, 30);
+ g.drawString("Player HP: " + player.getHealth() + " Round " + Spawn.getWave(), 5, 30);
}
@Override
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
+
if(!paused){
+
Collision.checkCollisions(entities.getEntities());
+
Spawn.spawnWave(entities.getEntities(), entities);
+
entities.update(delta);
if(input.isKeyDown(Input.KEY_W)){
@@ -1,30 +1,38 @@
package org.gdc.gdcalaga;
import java.util.ArrayList;
+/*
+ * I want this class to learn about the player constantly. It needs to observe the player and from there, decide how to suit the level
+ * for the player. We don't have many enemies yet, but we should later have enemies with unique characteristics and features. The class
+ * should know how often the player shoots, accuracy, how much the player moves or jitters. Place tanky enemies, quick enemies, anything
+ * to make the player adapt, even if it's only a little. The class should also make sure that the player gets a good variety of enemies,
+ * not just one type of enemy all the time. I, subsage will handle it, unless anyone else wants to, going to bed.
+ */
+
public class Spawn
{
- // I might have approached this wrongly with ents and mng...
- // As for everything else, it's cool. I want to eventually asses how the player does on a round
- // and then give them a fitting round tailored to how they did.
- public static int numberOfEnemies=1;
- public static int wave=1;
+
+ private static int numberOfEnemies=1;
+ private static int wave=0;
+
public static void spawnWave(ArrayList<Entity> ents, EntityManager mng) {
int countOfEnemies=0;
- for(Entity e:ents)
+ for(Entity e : ents)
{
if(e instanceof Enemy)
{
countOfEnemies++;
}
}
+
if(countOfEnemies==0)
{
- for(int a=0; a<numberOfEnemies;a++)
+ for(int a=0; a < numberOfEnemies; a++)
{
float x, y;
x = (float)(Math.random()*400)+800;
@@ -50,4 +58,11 @@ public static void spawnWave(ArrayList<Entity> ents, EntityManager mng) {
}
+ public static void updateStatistics(){
+ //TODO: Updates statistics on player.
+ }
+
+ public static int getWave(){
+ return wave;
+ }
}

0 comments on commit 070a1d2

Please sign in to comment.