Added license text.

This commit is contained in:
Jeasonfire 2015-05-18 03:22:13 +03:00
parent 8bd04ed140
commit 07a8ae7b3a
69 changed files with 1286 additions and 106 deletions

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator;
import com.badlogic.ashley.core.Engine; import com.badlogic.ashley.core.Engine;
@ -54,7 +71,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
// Initialize GUI // Initialize GUI
guiManager = new GUIManager(); guiManager = new GUIManager();
AppUtil.guiManager = this.guiManager; AppUtil.guiManager = this.guiManager;
// Initialize Jukebox // Initialize Jukebox
jukebox = new Jukebox(); jukebox = new Jukebox();
AppUtil.jukebox = this.jukebox; AppUtil.jukebox = this.jukebox;

View File

@ -1,3 +1,20 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import com.badlogic.ashley.core.Component; import com.badlogic.ashley.core.Component;

View File

@ -1,3 +1,20 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,13 +1,30 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import com.badlogic.ashley.core.Component; import com.badlogic.ashley.core.Component;
public class CDestructive extends Component { public class CDestructive extends Component {
public CDestructive(float time) { public CDestructive(float time) {
this.timeLeft = time; this.timeLeft = time;
} }
public float timeLeft = 0; public float timeLeft = 0;
} }

View File

@ -1,3 +1,20 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import com.badlogic.ashley.core.Component; import com.badlogic.ashley.core.Component;

View File

@ -1,3 +1,20 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import com.badlogic.ashley.core.Component; import com.badlogic.ashley.core.Component;
@ -28,7 +45,7 @@ public class CPhysics extends Component {
// Stores information about the direction last time moved in // Stores information about the direction last time moved in
public boolean movedLeftLast = false; public boolean movedLeftLast = false;
// Stores a float that tells how long the physics object must wait until it can play sounds with it's walking again. // Stores a float that tells how long the physics object must wait until it can play sounds with it's walking again.
public float stepCD = 0; public float stepCD = 0;

View File

@ -1,3 +1,20 @@
/**
* 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.components; package com.saltosion.gladiator.components;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,3 +1,20 @@
/**
* 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.gui; package com.saltosion.gladiator.gui;
import com.saltosion.gladiator.gui.nodes.GUINode; import com.saltosion.gladiator.gui.nodes.GUINode;

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
/** /**

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.saltosion.gladiator.gui.nodes.ButtonNode; import com.saltosion.gladiator.gui.nodes.ButtonNode;
@ -18,7 +35,7 @@ public class GameOverGUICreator implements GUICreator {
SpriteLoader.loadSprite(Name.MENU_BACKGROUND)); SpriteLoader.loadSprite(Name.MENU_BACKGROUND));
backgroundImg.setPosition(.5f, .5f); backgroundImg.setPosition(.5f, .5f);
AppUtil.guiManager.getRootNode().addChild(backgroundImg); AppUtil.guiManager.getRootNode().addChild(backgroundImg);
GUINode menuNode = new GUINode("menu-node"); GUINode menuNode = new GUINode("menu-node");
menuNode.setPosition(-.5f, -.5f); menuNode.setPosition(-.5f, -.5f);
backgroundImg.addChild(menuNode); backgroundImg.addChild(menuNode);

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.saltosion.gladiator.gui.nodes.TextNode; import com.saltosion.gladiator.gui.nodes.TextNode;

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
@ -42,7 +59,7 @@ public class MainMenuGUICreator implements GUICreator {
playButtonText.setPosition(-0.039f, 0.0175f); playButtonText.setPosition(-0.039f, 0.0175f);
playButton.addChild(playButtonText); playButton.addChild(playButtonText);
menuNode.addChild(playButton); menuNode.addChild(playButton);
ButtonNode quitButton = new ButtonNode("quit_button", SpriteLoader.loadSprite(Name.BUTTON_BIG), ButtonNode quitButton = new ButtonNode("quit_button", SpriteLoader.loadSprite(Name.BUTTON_BIG),
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) { SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
@Override @Override

View File

@ -1,3 +1,20 @@
/**
* 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.gui.creators; package com.saltosion.gladiator.gui.creators;
import com.saltosion.gladiator.gui.nodes.ButtonNode; import com.saltosion.gladiator.gui.nodes.ButtonNode;
@ -18,7 +35,7 @@ public class WinGUICreator implements GUICreator {
SpriteLoader.loadSprite(Name.MENU_BACKGROUND)); SpriteLoader.loadSprite(Name.MENU_BACKGROUND));
backgroundImg.setPosition(.5f, .5f); backgroundImg.setPosition(.5f, .5f);
AppUtil.guiManager.getRootNode().addChild(backgroundImg); AppUtil.guiManager.getRootNode().addChild(backgroundImg);
GUINode menuNode = new GUINode("menu-node"); GUINode menuNode = new GUINode("menu-node");
menuNode.setPosition(-.5f, -.5f); menuNode.setPosition(-.5f, -.5f);
backgroundImg.addChild(menuNode); backgroundImg.addChild(menuNode);

View File

@ -1,32 +1,49 @@
/**
* 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.gui.nodes; package com.saltosion.gladiator.gui.nodes;
import com.saltosion.gladiator.gui.properties.ImageProperty; import com.saltosion.gladiator.gui.properties.ImageProperty;
import com.saltosion.gladiator.gui.properties.InteractiveProperty; import com.saltosion.gladiator.gui.properties.InteractiveProperty;
import com.saltosion.gladiator.gui.nodes.GUINode;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
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;
public abstract class ButtonNode extends GUINode implements InteractiveProperty, ImageProperty { public abstract class ButtonNode extends GUINode implements InteractiveProperty, ImageProperty {
private final Sprite onHover; private final Sprite onHover;
private final Sprite normal; private final Sprite normal;
private boolean hovered = false; private boolean hovered = false;
public ButtonNode(String ID, Sprite onHover, Sprite normal) { public ButtonNode(String ID, Sprite onHover, Sprite normal) {
super(ID); super(ID);
this.onHover = onHover; this.onHover = onHover;
this.normal = normal; this.normal = normal;
} }
public void playButtonPressSound() { public void playButtonPressSound() {
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_PRESS), AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_PRESS),
AppUtil.sfxVolume/2); AppUtil.sfxVolume / 2);
} }
public void playButtonReleaseSound() { public void playButtonReleaseSound() {
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_RELEASE), AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_RELEASE),
AppUtil.sfxVolume/2); AppUtil.sfxVolume / 2);
} }
@Override @Override
@ -35,7 +52,7 @@ public abstract class ButtonNode extends GUINode implements InteractiveProperty,
} }
@Override @Override
public void mouseLeave(float x, float y){ public void mouseLeave(float x, float y) {
hovered = false; hovered = false;
} }

View File

@ -1,3 +1,20 @@
/**
* 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.gui.nodes; package com.saltosion.gladiator.gui.nodes;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;

View File

@ -1,3 +1,20 @@
/**
* 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/>.
*/
/* /*
* To change this license header, choose License Headers in Project Properties. * To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates

View File

@ -1,3 +1,20 @@
/**
* 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.gui.nodes; package com.saltosion.gladiator.gui.nodes;
import com.saltosion.gladiator.gui.properties.TextProperty; import com.saltosion.gladiator.gui.properties.TextProperty;

View File

@ -1,8 +1,25 @@
/**
* 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.gui.properties; package com.saltosion.gladiator.gui.properties;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
public interface ImageProperty { public interface ImageProperty {
public Sprite getImage(); public Sprite getImage();
} }

View File

@ -1,3 +1,20 @@
/**
* 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.gui.properties; package com.saltosion.gladiator.gui.properties;
public interface InteractiveProperty { public interface InteractiveProperty {

View File

@ -1,3 +1,20 @@
/**
* 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.gui.properties; package com.saltosion.gladiator.gui.properties;
public interface TextProperty { public interface TextProperty {

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.input;
import com.saltosion.gladiator.systems.RenderingSystem; import com.saltosion.gladiator.systems.RenderingSystem;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.input;
import com.saltosion.gladiator.components.CPhysics; import com.saltosion.gladiator.components.CPhysics;
@ -5,18 +22,18 @@ import com.saltosion.gladiator.util.AppUtil;
public class IRJump implements InputReceiver { public class IRJump implements InputReceiver {
@Override @Override
public boolean pressed() { public boolean pressed() {
CPhysics physics = AppUtil.player.getComponent(CPhysics.class); CPhysics physics = AppUtil.player.getComponent(CPhysics.class);
physics.jumping = true; physics.jumping = true;
return true; return true;
} }
@Override @Override
public boolean released() { public boolean released() {
CPhysics physics = AppUtil.player.getComponent(CPhysics.class); CPhysics physics = AppUtil.player.getComponent(CPhysics.class);
physics.jumping = false; physics.jumping = false;
return true; return true;
} }
} }

View File

@ -1,7 +1,22 @@
/**
* 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; package com.saltosion.gladiator.input;
import com.badlogic.ashley.core.Family;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CPhysics; import com.saltosion.gladiator.components.CPhysics;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;

View File

@ -1,7 +1,22 @@
/**
* 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; package com.saltosion.gladiator.input;
import com.badlogic.ashley.core.Family;
import com.badlogic.gdx.math.Vector2;
import com.saltosion.gladiator.components.CPhysics; import com.saltosion.gladiator.components.CPhysics;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;

View File

@ -1,14 +1,30 @@
/**
* 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; package com.saltosion.gladiator.input;
import com.saltosion.gladiator.components.CCombat; import com.saltosion.gladiator.components.CCombat;
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;
public class IRSwing implements InputReceiver { public class IRSwing implements InputReceiver {
private Direction dir; private final Direction dir;
public IRSwing(Direction dir) { public IRSwing(Direction dir) {
this.dir = dir; this.dir = dir;
} }

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.input;
import java.util.HashMap; import java.util.HashMap;
@ -32,12 +49,12 @@ public class InputHandler implements InputProcessor {
addInput(Keys.DOWN, Name.SWING_DOWN, false); addInput(Keys.DOWN, Name.SWING_DOWN, false);
addInput(Keys.F2, Name.DEBUG, false); addInput(Keys.F2, Name.DEBUG, false);
} }
private void addInput(int key, String action, boolean activated) { private void addInput(int key, String action, boolean activated) {
keys.put(key, action); keys.put(key, action);
activatedInputs.put(action, activated); activatedInputs.put(action, activated);
} }
public void setInputEnabled(String action, boolean enabled) { public void setInputEnabled(String action, boolean enabled) {
activatedInputs.put(action, enabled); activatedInputs.put(action, enabled);
} }
@ -46,7 +63,10 @@ public class InputHandler implements InputProcessor {
public boolean keyDown(int keycode) { public boolean keyDown(int keycode) {
if (!keys.containsKey(keycode)) { if (!keys.containsKey(keycode)) {
return false; return false;
} if (!activatedInputs.get(keys.get(keycode))) { return false; } }
if (!activatedInputs.get(keys.get(keycode))) {
return false;
}
String actionName = keys.get(keycode); String actionName = keys.get(keycode);
return InputReceivers.getReceiver(actionName).pressed(); return InputReceivers.getReceiver(actionName).pressed();
} }
@ -55,7 +75,10 @@ public class InputHandler implements InputProcessor {
public boolean keyUp(int keycode) { public boolean keyUp(int keycode) {
if (!keys.containsKey(keycode)) { if (!keys.containsKey(keycode)) {
return false; return false;
} if (!activatedInputs.get(keys.get(keycode))) { return false; } }
if (!activatedInputs.get(keys.get(keycode))) {
return false;
}
String actionName = keys.get(keycode); String actionName = keys.get(keycode);
return InputReceivers.getReceiver(actionName).released(); return InputReceivers.getReceiver(actionName).released();
} }

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.input;
public interface InputReceiver { public interface InputReceiver {

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.input;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level;
public interface Level { public interface Level {

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,10 +1,26 @@
/**
* 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; package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity; 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.BerserkerAI;
import com.saltosion.gladiator.listeners.ai.HeavenWorshiperAI; import com.saltosion.gladiator.listeners.ai.HeavenWorshiperAI;
import com.saltosion.gladiator.util.AppUtil; import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Direction; import com.saltosion.gladiator.util.Direction;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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; package com.saltosion.gladiator.level.premade;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners; package com.saltosion.gladiator.listeners;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners; package com.saltosion.gladiator.listeners;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners; package com.saltosion.gladiator.listeners;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners; package com.saltosion.gladiator.listeners;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners; package com.saltosion.gladiator.listeners;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,7 +67,7 @@ public class SwingHitboxListener implements CollisionListener {
} }
float force = cm.get(source).getSwingForce(); float force = cm.get(source).getSwingForce();
pm.get(source).setSimVelocity(x * force, 0); pm.get(source).setSimVelocity(x * force, 0);
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_CLANG01), Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_CLANG01),
AudioLoader.getSound(Name.SOUND_CLANG02), AudioLoader.getSound(Name.SOUND_CLANG02),
AudioLoader.getSound(Name.SOUND_CLANG03), AudioLoader.getSound(Name.SOUND_CLANG03),

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Entity;

View File

@ -1,3 +1,20 @@
/**
* 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.listeners.ai; package com.saltosion.gladiator.listeners.ai;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.GladiatorBrawler; import com.saltosion.gladiator.GladiatorBrawler;

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.GameOverGUICreator; import com.saltosion.gladiator.gui.creators.GameOverGUICreator;

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.InGameGUICreator; import com.saltosion.gladiator.gui.creators.InGameGUICreator;

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.IntroGUICreator; import com.saltosion.gladiator.gui.creators.IntroGUICreator;

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.MainMenuGUICreator; import com.saltosion.gladiator.gui.creators.MainMenuGUICreator;
@ -14,7 +31,7 @@ public class MainMenuState extends BaseState {
// Play music // Play music
AppUtil.jukebox.playMusic(AudioLoader.getMusic(Name.MUSIC_THEME)); AppUtil.jukebox.playMusic(AudioLoader.getMusic(Name.MUSIC_THEME));
AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume); AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume);
// Start from a clean slate // Start from a clean slate
AppUtil.guiManager.clearGUI(); AppUtil.guiManager.clearGUI();

View File

@ -1,3 +1,20 @@
/**
* 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.state; package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.WinGUICreator; import com.saltosion.gladiator.gui.creators.WinGUICreator;

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;
@ -13,18 +30,18 @@ public class MiscManagerSystem extends EntitySystem {
private ComponentMapper<CDestructive> dm = ComponentMapper.getFor(CDestructive.class); private ComponentMapper<CDestructive> dm = ComponentMapper.getFor(CDestructive.class);
private ImmutableArray<Entity> entities; private ImmutableArray<Entity> entities;
@Override @Override
public void addedToEngine(Engine engine) { public void addedToEngine(Engine engine) {
updateEntities(engine); updateEntities(engine);
} }
@Override @Override
public void update(float deltaTime) { public void update(float deltaTime) {
for (int i=0; i<entities.size(); i++) { for (int i = 0; i < entities.size(); i++) {
Entity e = entities.get(i); Entity e = entities.get(i);
CDestructive des = dm.get(e); CDestructive des = dm.get(e);
if (des.timeLeft > 0) { if (des.timeLeft > 0) {
des.timeLeft -= deltaTime; des.timeLeft -= deltaTime;
} else { } else {
@ -32,7 +49,7 @@ public class MiscManagerSystem extends EntitySystem {
} }
} }
} }
public void updateEntities(Engine engine) { public void updateEntities(Engine engine) {
entities = engine.getEntitiesFor(Family.getFor(CDestructive.class)); entities = engine.getEntitiesFor(Family.getFor(CDestructive.class));
} }

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;
@ -61,7 +78,7 @@ public class PhysicsSystem extends EntitySystem {
if (obj.jumping && obj.isGrounded()) { if (obj.jumping && obj.isGrounded()) {
obj.setGrounded(false); obj.setGrounded(false);
obj.getVelocity().y = obj.getJumpForce(); obj.getVelocity().y = obj.getJumpForce();
// Sound effect! // Sound effect!
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume); AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume);
} }

View File

@ -1,3 +1,20 @@
/**
* 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.systems; package com.saltosion.gladiator.systems;
import com.badlogic.ashley.core.ComponentMapper; import com.badlogic.ashley.core.ComponentMapper;
@ -189,7 +206,7 @@ public class RenderingSystem extends EntitySystem {
if (po.stepCD > 0) { if (po.stepCD > 0) {
po.stepCD -= deltaTime; po.stepCD -= deltaTime;
} }
if (moving && combat) { if (moving && combat) {
ro.playAnimation("torso", "Torso-Combat-" + dirSwing); ro.playAnimation("torso", "Torso-Combat-" + dirSwing);
ro.playAnimation("legs", "Legs-Run-" + dirMove); ro.playAnimation("legs", "Legs-Run-" + dirMove);
@ -206,13 +223,13 @@ public class RenderingSystem extends EntitySystem {
ro.playAnimation("legs", "Legs-Idle-" + dirMove); ro.playAnimation("legs", "Legs-Idle-" + dirMove);
} }
} }
private void tryToMakeStepSound(CPhysics po) { private void tryToMakeStepSound(CPhysics po) {
if (po.stepCD > 0 || !po.isGrounded()) { if (po.stepCD > 0 || !po.isGrounded()) {
return; return;
} }
po.stepCD = 0.3f; po.stepCD = 0.3f;
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume/3*2); AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume / 3 * 2);
} }
private void renderEntities(float deltaTime) { private void renderEntities(float deltaTime) {

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import com.badlogic.ashley.core.Engine; import com.badlogic.ashley.core.Engine;
@ -19,7 +36,7 @@ public class AppUtil {
public static InputHandler inputHandler; public static InputHandler inputHandler;
public static final int VPHEIGHT_CONST = 24; public static final int VPHEIGHT_CONST = 24;
public static float sfxVolume = 0.3f; public static float sfxVolume = 0.3f;
public static float musicVolume = 0.7f; public static float musicVolume = 0.7f;

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
@ -6,10 +23,10 @@ import com.badlogic.gdx.audio.Sound;
import java.util.HashMap; import java.util.HashMap;
public class AudioLoader { public class AudioLoader {
private static HashMap<String, Sound> sounds = new HashMap<String, Sound>(); private static final HashMap<String, Sound> sounds = new HashMap<String, Sound>();
private static HashMap<String, Music> musics = new HashMap<String, Music>(); private static final HashMap<String, Music> musics = new HashMap<String, Music>();
static { static {
// Import all the sounds & musix // Import all the sounds & musix
AudioLoader.musics.put(Name.MUSIC_THEME, loadMusic("audio/theme.ogg")); AudioLoader.musics.put(Name.MUSIC_THEME, loadMusic("audio/theme.ogg"));
@ -30,23 +47,23 @@ public class AudioLoader {
AudioLoader.sounds.put(Name.SOUND_BUTTON_PRESS, loadSound("audio/button_press.ogg")); AudioLoader.sounds.put(Name.SOUND_BUTTON_PRESS, loadSound("audio/button_press.ogg"));
AudioLoader.sounds.put(Name.SOUND_BUTTON_RELEASE, loadSound("audio/button_release.ogg")); AudioLoader.sounds.put(Name.SOUND_BUTTON_RELEASE, loadSound("audio/button_release.ogg"));
} }
private static Music loadMusic(String path) { private static Music loadMusic(String path) {
return Gdx.audio.newMusic(Gdx.files.internal(path)); return Gdx.audio.newMusic(Gdx.files.internal(path));
} }
private static Sound loadSound(String path) { private static Sound loadSound(String path) {
return Gdx.audio.newSound(Gdx.files.internal(path)); return Gdx.audio.newSound(Gdx.files.internal(path));
} }
public static Sound getSound(String id) { public static Sound getSound(String id) {
return sounds.get(id); return sounds.get(id);
} }
public static Music getMusic(String id) { public static Music getMusic(String id) {
return musics.get(id); return musics.get(id);
} }
public static void dispose() { public static void dispose() {
Log.info("Disposed sounds and musics!"); Log.info("Disposed sounds and musics!");
for (String s : sounds.keySet()) { for (String s : sounds.keySet()) {
@ -56,5 +73,5 @@ public class AudioLoader {
musics.get(s).dispose(); musics.get(s).dispose();
} }
} }
} }

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
public enum Direction { public enum Direction {

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
public class Global { public class Global {

View File

@ -1,16 +1,33 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.audio.Sound;
public class Jukebox { public class Jukebox {
private Music currentMusic; private Music currentMusic;
private float volume = 1; private float volume = 1;
/** /**
* Plays the musix like a baws. * Plays the musix like a baws.
*
* @param music * @param music
* @return boolean if the musix failed to play * @return boolean if the musix failed to play
*/ */
@ -21,35 +38,42 @@ public class Jukebox {
} }
if (music.equals(currentMusic)) { if (music.equals(currentMusic)) {
return false; return false;
} if (currentMusic != null) { currentMusic.stop(); }; }
if (currentMusic != null) {
currentMusic.stop();
};
music.play(); music.play();
music.setVolume(volume); music.setVolume(volume);
music.setLooping(true); music.setLooping(true);
currentMusic = music; currentMusic = music;
return true; return true;
} }
public Music getCurrentMusic() { public Music getCurrentMusic() {
return this.currentMusic; return this.currentMusic;
} }
public void setMusicVolume(float volume) { public void setMusicVolume(float volume) {
this.volume = volume; this.volume = volume;
if (currentMusic == null) {return;} if (currentMusic == null) {
return;
}
this.currentMusic.setVolume(volume); this.currentMusic.setVolume(volume);
} }
/** /**
* Simply plays the sound * Simply plays the sound
*
* @param sound * @param sound
* @return long returns sound's id * @return long returns sound's id
*/ */
public long playSound(Sound sound) { public long playSound(Sound sound) {
return sound.play(); return sound.play();
} }
/** /**
* Play sound and set it's volume * Play sound and set it's volume
*
* @param sound * @param sound
* @param volume 0-1f * @param volume 0-1f
* @return long returns sound's id * @return long returns sound's id
@ -59,9 +83,10 @@ public class Jukebox {
sound.setVolume(id, volume); sound.setVolume(id, volume);
return id; return id;
} }
/** /**
* Play sound and set it's volume & pan * Play sound and set it's volume & pan
*
* @param sound * @param sound
* @param volume 0-1f * @param volume 0-1f
* @param pan ? * @param pan ?
@ -72,8 +97,8 @@ public class Jukebox {
sound.setPan(id, pan, volume); sound.setPan(id, pan, volume);
return id; return id;
} }
public Sound returnRandomSound(Sound ... args) { public Sound returnRandomSound(Sound... args) {
return args[(int) Math.floor(Math.random()*args.length)]; return args[(int) Math.floor(Math.random() * args.length)];
} }
} }

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -5,7 +22,6 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Calendar; import java.util.Calendar;
/** /**

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
public class Name { public class Name {

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,3 +1,20 @@
/**
* 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.util; package com.saltosion.gladiator.util;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,37 +23,37 @@ import com.badlogic.gdx.graphics.g2d.Sprite;
public class SpriteSequence { public class SpriteSequence {
private final ArrayList<Sprite> sprites = new ArrayList<Sprite>(); private final ArrayList<Sprite> sprites = new ArrayList<Sprite>();
private float defaultPlayspeed = 1; private float defaultPlayspeed = 1;
/** /**
* A static single image. * A static single image.
* *
* @param sprite * @param sprite
*/ */
public SpriteSequence(Sprite sprite) { public SpriteSequence(Sprite sprite) {
sprites.add(sprite); sprites.add(sprite);
defaultPlayspeed = 0; defaultPlayspeed = 0;
} }
public SpriteSequence(float playspeed) { public SpriteSequence(float playspeed) {
this.defaultPlayspeed = playspeed; this.defaultPlayspeed = playspeed;
} }
public SpriteSequence addSprite(Sprite s) { public SpriteSequence addSprite(Sprite s) {
sprites.add(s); sprites.add(s);
return this; return this;
} }
public Sprite getSprite(int index) { public Sprite getSprite(int index) {
return sprites.get(index); return sprites.get(index);
} }
public float getPlayspeed() { public float getPlayspeed() {
return defaultPlayspeed; return defaultPlayspeed;
} }
public int frameCount() { public int frameCount() {
return sprites.size(); return sprites.size();
} }
} }