Compare commits
No commits in common. "master" and "1.0" have entirely different histories.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@ -1,38 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.input;
|
|
||||||
|
|
||||||
import com.saltosion.gladiator.GladiatorBrawler;
|
|
||||||
import com.saltosion.gladiator.state.InGameState;
|
|
||||||
|
|
||||||
public class IRNextLevel implements InputReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean pressed() {
|
|
||||||
if (GladiatorBrawler.currentState instanceof InGameState) {
|
|
||||||
((InGameState) GladiatorBrawler.currentState).nextLevel();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean released() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -49,7 +49,6 @@ public class InputHandler implements InputProcessor {
|
|||||||
addInput(Keys.DOWN, Name.SWING_DOWN, false);
|
addInput(Keys.DOWN, Name.SWING_DOWN, false);
|
||||||
addInput(Keys.F2, Name.DEBUG, true);
|
addInput(Keys.F2, Name.DEBUG, true);
|
||||||
addInput(Keys.ESCAPE, Name.SKIP_INTRO, false);
|
addInput(Keys.ESCAPE, Name.SKIP_INTRO, false);
|
||||||
addInput(Keys.F3, Name.NEXT_LEVEL, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInput(int key, String action, boolean activated) {
|
private void addInput(int key, String action, boolean activated) {
|
||||||
|
@ -36,7 +36,6 @@ public class InputReceivers {
|
|||||||
inputreceivers.put(Name.SWING_DOWN, new IRSwing(Direction.DOWN));
|
inputreceivers.put(Name.SWING_DOWN, new IRSwing(Direction.DOWN));
|
||||||
inputreceivers.put(Name.DEBUG, new IRDebugToggle());
|
inputreceivers.put(Name.DEBUG, new IRDebugToggle());
|
||||||
inputreceivers.put(Name.SKIP_INTRO, new IRSkipIntros());
|
inputreceivers.put(Name.SKIP_INTRO, new IRSkipIntros());
|
||||||
inputreceivers.put(Name.NEXT_LEVEL, new IRNextLevel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputReceiver getReceiver(String key) {
|
public static InputReceiver getReceiver(String key) {
|
||||||
|
@ -141,12 +141,6 @@ public class EntityFactory {
|
|||||||
.addSprite(playerSprites[1][9][1]);
|
.addSprite(playerSprites[1][9][1]);
|
||||||
renderedObject.addSequence("Legs-Run-Left", legsRunLeftSequence);
|
renderedObject.addSequence("Legs-Run-Left", legsRunLeftSequence);
|
||||||
|
|
||||||
// Jumping animation
|
|
||||||
SpriteSequence legsJumpRightSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[1][8][0]);
|
|
||||||
renderedObject.addSequence("Legs-Jump-Right", legsJumpRightSequence);
|
|
||||||
SpriteSequence legsJumpLeftSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[1][8][1]);
|
|
||||||
renderedObject.addSequence("Legs-Jump-Left", legsJumpLeftSequence);
|
|
||||||
|
|
||||||
// Combat animations
|
// Combat animations
|
||||||
SpriteSequence torsoCombatRightSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[0][7][0])
|
SpriteSequence torsoCombatRightSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[0][7][0])
|
||||||
.addSprite(playerSprites[0][8][0]).addSprite(playerSprites[0][9][0]).addSprite(playerSprites[0][10][0]);
|
.addSprite(playerSprites[0][8][0]).addSprite(playerSprites[0][9][0]).addSprite(playerSprites[0][10][0]);
|
||||||
|
@ -81,7 +81,6 @@ public class InGameState extends BaseState {
|
|||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_LEFT, true);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_LEFT, true);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_RIGHT, true);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_RIGHT, true);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_UP, true);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_UP, true);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.NEXT_LEVEL, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -101,8 +100,13 @@ public class InGameState extends BaseState {
|
|||||||
if (level.levelCleared()) {
|
if (level.levelCleared()) {
|
||||||
timeSinceLevelWon += deltaTime;
|
timeSinceLevelWon += deltaTime;
|
||||||
if (timeSinceLevelWon > levelWonDelay) {
|
if (timeSinceLevelWon > levelWonDelay) {
|
||||||
|
currentLevel++;
|
||||||
timeSinceLevelWon = 0;
|
timeSinceLevelWon = 0;
|
||||||
nextLevel();
|
if (currentLevel >= levels.length) {
|
||||||
|
setState(new WinState());
|
||||||
|
} else {
|
||||||
|
changeLevel(levels[currentLevel]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,15 +118,6 @@ public class InGameState extends BaseState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nextLevel() {
|
|
||||||
currentLevel++;
|
|
||||||
if (currentLevel >= levels.length) {
|
|
||||||
setState(new WinState());
|
|
||||||
} else {
|
|
||||||
changeLevel(levels[currentLevel]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeLevel(Level level) {
|
public void changeLevel(Level level) {
|
||||||
AppUtil.engine.removeAllEntities();
|
AppUtil.engine.removeAllEntities();
|
||||||
this.level = level;
|
this.level = level;
|
||||||
@ -141,7 +136,6 @@ public class InGameState extends BaseState {
|
|||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_LEFT, false);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_LEFT, false);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_RIGHT, false);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_RIGHT, false);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.SWING_UP, false);
|
AppUtil.inputHandler.setInputEnabled(Name.SWING_UP, false);
|
||||||
AppUtil.inputHandler.setInputEnabled(Name.NEXT_LEVEL, false);
|
|
||||||
|
|
||||||
// Clear all entities that are left as they are no longer needed
|
// Clear all entities that are left as they are no longer needed
|
||||||
AppUtil.engine.removeAllEntities();
|
AppUtil.engine.removeAllEntities();
|
||||||
|
@ -222,9 +222,6 @@ public class RenderingSystem extends EntitySystem {
|
|||||||
ro.playAnimation("torso", "Torso-Idle-" + dirMove);
|
ro.playAnimation("torso", "Torso-Idle-" + dirMove);
|
||||||
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
||||||
}
|
}
|
||||||
if (!po.isGrounded()) {
|
|
||||||
ro.playAnimation("legs", "Legs-Jump-" + dirMove);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryToMakeStepSound(CPhysics po) {
|
private void tryToMakeStepSound(CPhysics po) {
|
||||||
|
@ -51,7 +51,6 @@ public class Name {
|
|||||||
public static final String SWING_UP = "SWING_UP";
|
public static final String SWING_UP = "SWING_UP";
|
||||||
public static final String SWING_DOWN = "SWING_DOWN";
|
public static final String SWING_DOWN = "SWING_DOWN";
|
||||||
public static final String SKIP_INTRO = "SKIP_INTRO";
|
public static final String SKIP_INTRO = "SKIP_INTRO";
|
||||||
public static final String NEXT_LEVEL = "NEXT_LEVEL";
|
|
||||||
public static final String DEBUG = "DEBUG";
|
public static final String DEBUG = "DEBUG";
|
||||||
|
|
||||||
public static final String MUSIC_THEME = "MUSIC_THEME";
|
public static final String MUSIC_THEME = "MUSIC_THEME";
|
||||||
|
Loading…
Reference in New Issue
Block a user