Fixed nullpointer in Round 10.

This commit is contained in:
Jeasonfire 2015-05-18 04:36:47 +03:00
parent 2f94f7e0bf
commit fc42cabe10
2 changed files with 20 additions and 11 deletions

View File

@ -1,7 +1,19 @@
/* /**
* To change this license header, choose License Headers in Project Properties. * GladiatorBrawler is a 2D swordfighting game.
* To change this template file, choose Tools | Templates * Copyright (C) 2015 Jeasonfire/Allexit
* and open the template in the editor. *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.saltosion.gladiator.level.premade; package com.saltosion.gladiator.level.premade;
@ -15,10 +27,6 @@ import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global; import com.saltosion.gladiator.util.Global;
import java.util.ArrayList; import java.util.ArrayList;
/**
*
* @author Medvith
*/
public class Round10Level implements Level { public class Round10Level implements Level {
public Entity player; public Entity player;
@ -47,8 +55,9 @@ public class Round10Level implements Level {
@Override @Override
public void generate() { public void generate() {
AppUtil.levelFactory.createLevelBase(); AppUtil.levelFactory.createLevelBase();
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, player = AppUtil.entityFactory.createPlayer(new Vector2(-7.5f, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(7.5f, 2), Direction.LEFT,
new CAI().setReactDistance(15f).setAIListener(new RelentlessAI()))); new CAI().setReactDistance(15f).setAIListener(new RelentlessAI())));
} }
} }

View File

@ -39,7 +39,7 @@ public class InGameState extends BaseState {
* Add new levels to this list * Add new levels to this list
*/ */
private static final Level[] levels = {new Round1Level(), new Round2Level(), private static final Level[] levels = {new Round1Level(), new Round2Level(),
new Round3Level(), new Round4Level(), new Round5Level(), new Round6Level(), new Round3Level(), new Round4Level(), new Round5Level(), new Round6Level(),
new Round7Level(), new Round8Level(), new Round9Level(), new Round10Level()}; new Round7Level(), new Round8Level(), new Round9Level(), new Round10Level()};
private Level level; private Level level;