Beispiel #1
0
 private void generateEntity() {
   float spawnFreq = 0.15f;
   if (this.rand.nextFloat() <= spawnFreq && nbMob <= maxSpawnLevel) {
     Vector2f position =
         new Vector2f(rand.nextInt(width * Tile.SIZE), rand.nextInt(height * Tile.SIZE));
     EntityHuman human = new EntityHuman(this);
     if (human.canSpawnHere(position.x, position.y)) {
       human.setPosition(position);
       this.addEntity(human);
       this.nbMob++;
     }
   }
 }
Beispiel #2
0
 public void addHuman(Vector2f position) {
   EntityHuman human = new EntityHuman(this);
   human.setPosition(position);
   this.addEntity(human);
   this.nbMob++;
 }