Added 5 more levels

This commit is contained in:
Allexit 2015-05-18 04:26:34 +03:00
parent 5ccb90911d
commit e79f3f5e10
9 changed files with 344 additions and 12 deletions

View File

@ -0,0 +1,54 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.RelentlessAI;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global;
import java.util.ArrayList;
/**
*
* @author Medvith
*/
public class Round10Level implements Level {
public Entity player;
public ArrayList<Entity> enemies = new ArrayList<Entity>();
@Override
public String getLevelName() {
return "Final Boss Round";
}
@Override
public boolean levelCleared() {
for (Entity enemy : enemies) {
if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) {
return false;
}
}
return true;
}
@Override
public boolean levelFailed() {
return (player.flags & Global.FLAG_ALIVE) == 0;
}
@Override
public void generate() {
AppUtil.levelFactory.createLevelBase();
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(15f).setAIListener(new RelentlessAI())));
}
}

View File

@ -21,7 +21,7 @@ import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI; import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level; import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.PanicAI; import com.saltosion.gladiator.listeners.ai.ScaredAI;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction; import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global; import com.saltosion.gladiator.util.Global;
@ -57,9 +57,7 @@ public class Round2Level implements Level {
AppUtil.levelFactory.createLevelBase(); AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT); player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(10f).setAIListener(new PanicAI()))); new CAI().setReactDistance(12f).setAIListener(new ScaredAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(10f).setAIListener(new PanicAI())));
} }
} }

View File

@ -21,7 +21,7 @@ import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI; import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level; import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.ScaredAI; import com.saltosion.gladiator.listeners.ai.HunterAI;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction; import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global; import com.saltosion.gladiator.util.Global;
@ -57,9 +57,9 @@ public class Round3Level implements Level {
AppUtil.levelFactory.createLevelBase(); AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT); player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI()))); new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT, enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI()))); new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
} }
} }

View File

@ -21,7 +21,7 @@ import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI; import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level; import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.HunterAI; import com.saltosion.gladiator.listeners.ai.PanicAI;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction; import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global; import com.saltosion.gladiator.util.Global;
@ -57,9 +57,7 @@ public class Round4Level implements Level {
AppUtil.levelFactory.createLevelBase(); AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT); player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI()))); new CAI().setReactDistance(18f).setAIListener(new PanicAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
} }
} }

View File

@ -0,0 +1,68 @@
/**
* GladiatorBrawler is a 2D swordfighting game.
* Copyright (C) 2015 Jeasonfire/Allexit
*
* 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;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.HunterAI;
import com.saltosion.gladiator.listeners.ai.ScaredAI;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global;
import java.util.ArrayList;
public class Round6Level implements Level {
public Entity player;
public ArrayList<Entity> enemies = new ArrayList<Entity>();
@Override
public String getLevelName() {
return "Round 6";
}
@Override
public boolean levelCleared() {
for (Entity enemy : enemies) {
if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) {
return false;
}
}
return true;
}
@Override
public boolean levelFailed() {
return (player.flags & Global.FLAG_ALIVE) == 0;
}
@Override
public void generate() {
AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(15, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
}
}

View File

@ -0,0 +1,70 @@
/**
* GladiatorBrawler is a 2D swordfighting game.
* Copyright (C) 2015 Jeasonfire/Allexit
*
* 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;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.PanicAI;
import com.saltosion.gladiator.listeners.ai.ScaredAI;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global;
import java.util.ArrayList;
public class Round7Level implements Level {
public Entity player;
public ArrayList<Entity> enemies = new ArrayList<Entity>();
@Override
public String getLevelName() {
return "Round 7";
}
@Override
public boolean levelCleared() {
for (Entity enemy : enemies) {
if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) {
return false;
}
}
return true;
}
@Override
public boolean levelFailed() {
return (player.flags & Global.FLAG_ALIVE) == 0;
}
@Override
public void generate() {
AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(18f).setAIListener(new PanicAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(20, 2), Direction.LEFT,
new CAI().setReactDistance(18f).setAIListener(new PanicAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-20, 2), Direction.RIGHT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI())));
}
}

View File

@ -0,0 +1,70 @@
/**
* GladiatorBrawler is a 2D swordfighting game.
* Copyright (C) 2015 Jeasonfire/Allexit
*
* 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;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.BerserkerAI;
import com.saltosion.gladiator.listeners.ai.HunterAI;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global;
import java.util.ArrayList;
public class Round8Level implements Level {
public Entity player;
public ArrayList<Entity> enemies = new ArrayList<Entity>();
@Override
public String getLevelName() {
return "Miniboss round (8)";
}
@Override
public boolean levelCleared() {
for (Entity enemy : enemies) {
if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) {
return false;
}
}
return true;
}
@Override
public boolean levelFailed() {
return (player.flags & Global.FLAG_ALIVE) == 0;
}
@Override
public void generate() {
AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(20, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT,
new CAI().setReactDistance(10f).setAIListener(new BerserkerAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-20, 2), Direction.RIGHT,
new CAI().setReactDistance(10f).setAIListener(new BerserkerAI())));
}
}

View File

@ -0,0 +1,68 @@
/**
* GladiatorBrawler is a 2D swordfighting game.
* Copyright (C) 2015 Jeasonfire/Allexit
*
* 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;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CAI;
import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.listeners.ai.HunterAI;
import com.saltosion.gladiator.listeners.ai.ScaredAI;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction;
import com.saltosion.gladiator.util.Global;
import java.util.ArrayList;
public class Round9Level implements Level {
public Entity player;
public ArrayList<Entity> enemies = new ArrayList<Entity>();
@Override
public String getLevelName() {
return "Round 9";
}
@Override
public boolean levelCleared() {
for (Entity enemy : enemies) {
if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) {
return false;
}
}
return true;
}
@Override
public boolean levelFailed() {
return (player.flags & Global.FLAG_ALIVE) == 0;
}
@Override
public void generate() {
AppUtil.levelFactory.createLevelBase();
player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT);
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.LEFT,
new CAI().setReactDistance(8f).setAIListener(new HunterAI())));
enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(20, 2), Direction.LEFT,
new CAI().setReactDistance(12f).setAIListener(new ScaredAI())));
}
}

View File

@ -19,11 +19,16 @@ package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.InGameGUICreator; import com.saltosion.gladiator.gui.creators.InGameGUICreator;
import com.saltosion.gladiator.level.Level; import com.saltosion.gladiator.level.Level;
import com.saltosion.gladiator.level.premade.Round10Level;
import com.saltosion.gladiator.level.premade.Round1Level; import com.saltosion.gladiator.level.premade.Round1Level;
import com.saltosion.gladiator.level.premade.Round2Level; import com.saltosion.gladiator.level.premade.Round2Level;
import com.saltosion.gladiator.level.premade.Round3Level; import com.saltosion.gladiator.level.premade.Round3Level;
import com.saltosion.gladiator.level.premade.Round4Level; import com.saltosion.gladiator.level.premade.Round4Level;
import com.saltosion.gladiator.level.premade.Round5Level; import com.saltosion.gladiator.level.premade.Round5Level;
import com.saltosion.gladiator.level.premade.Round6Level;
import com.saltosion.gladiator.level.premade.Round7Level;
import com.saltosion.gladiator.level.premade.Round8Level;
import com.saltosion.gladiator.level.premade.Round9Level;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.AudioLoader; import com.saltosion.gladiator.util.AudioLoader;
import com.saltosion.gladiator.util.Name; import com.saltosion.gladiator.util.Name;
@ -34,7 +39,8 @@ 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 Round3Level(), new Round4Level(), new Round5Level(), new Round6Level(),
new Round7Level(), new Round8Level(), new Round9Level(), new Round10Level()};
private Level level; private Level level;
private InGameGUICreator guiCreator; private InGameGUICreator guiCreator;