Skip to content
This repository was archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
Cleaned code and level shortcut keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ghunteranderson committed Nov 7, 2015
1 parent 444b600 commit 39f973b
Show file tree
Hide file tree
Showing 43 changed files with 73 additions and 627 deletions.
Binary file modified bin/grandtheftroster/elements/Model.class
Binary file not shown.
Binary file modified bin/grandtheftroster/elements/Thrown.class
Binary file not shown.
Binary file modified bin/grandtheftroster/handlers/GameStateManager$State.class
Binary file not shown.
Binary file modified bin/grandtheftroster/handlers/GameStateManager.class
Binary file not shown.
Binary file modified bin/grandtheftroster/handlers/Lvl1ContactListener.class
Binary file not shown.
Binary file modified bin/grandtheftroster/handlers/MyInputProcessor.class
Binary file not shown.
Binary file modified bin/grandtheftroster/main/Game.class
Binary file not shown.
Binary file modified bin/grandtheftroster/player/Player.class
Binary file not shown.
Binary file modified bin/grandtheftroster/states/GameOverState.class
Binary file not shown.
Binary file modified bin/grandtheftroster/states/GameState.class
Binary file not shown.
Binary file modified bin/grandtheftroster/states/InfoState.class
Binary file not shown.
Binary file modified bin/grandtheftroster/states/Lvl1State.class
Binary file not shown.
Binary file modified bin/grandtheftroster/states/SplashScreenState.class
Binary file not shown.
Binary file removed bin/grandtheftroster/utilities/ConfigTest.class
Binary file not shown.
Binary file modified bin/grandtheftroster/utilities/Configuration.class
Binary file not shown.
Binary file modified bin/grandtheftroster/utilities/Logger.class
Binary file not shown.
483 changes: 0 additions & 483 deletions hs_err_pid1130.log

This file was deleted.

22 changes: 22 additions & 0 deletions res/config/models/chair.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#This is a comment
#It Should be ignored

CONFIG_TYPE:MODEL
CONFIG_NAME:CHAIR

TAGS = MODEL,CHAIR

BODY_TYPE = STATIC
#BODY_POSITION_X = 50
#BODY_POSITION_Y = 20
#BODY_ANGLE = 5
BODY_ACTIVE = TRUE

#FIXTURE_COUNT = 1
FIXTURE_SHAPE_TYPE = CIRCLESHAPE
FIXTURE_SHAPE_RADIUS = 7
FIXTURE_FRICTION = 1
FIXTURE_RESTITUTION = 0
FIXTURE_SENSOR = TRUE

SPRITE = CHAIR
3 changes: 2 additions & 1 deletion res/config/paths/sprite paths.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ ROPE = res/images/rope.png
SWITCH_OFF = res/images/Switch_Off.png
SWITCH_ON = res/images/Switch_On.png
MOVING_PLATFORM = res/maps/table_platform.png
SPRING = res/images/spring_board.png
SPRING = res/images/spring_board.png
CHAIR = res/images/single red chair.png
Binary file added res/images/single red chair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions src/grandtheftroster/elements/Boss.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package grandtheftroster.elements;

import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.physics.box2d.World;
import static grandtheftroster.elements.B2DVars.PPM;

import grandtheftroster.handlers.AnimationManager;
import grandtheftroster.utilities.Configuration;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.physics.box2d.World;

public class Boss extends Model {
private AnimationManager am;
public static final int PUSHINGLEFT = 0;
Expand Down Expand Up @@ -54,7 +52,6 @@ private void loadAnimation() {
public void update(float dt)
{
super.update(dt);
//am.setState(state);
if(state == PUSHINGLEFT || state == PUSHINGRIGHT)
{
am.update(dt);
Expand Down
6 changes: 0 additions & 6 deletions src/grandtheftroster/elements/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
* Additional data and functionality could include a characters
* health, a model's weight, or the ability to change the sprite
* during game play.
*
* Change Log:
* 15.9.20gha: First Edition
* 15.9.29gha: Moved getSprite functionality from sub to super
* Moved variables from sub to super
*
*/

public class Model implements Switchable{
Expand Down
1 change: 1 addition & 0 deletions src/grandtheftroster/elements/Rope.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public float getLength(){
return length;
}

@Override
public void draw(SpriteBatch sb){
if(sprite == null) return;
float angle = body.getAngle();
Expand Down
3 changes: 1 addition & 2 deletions src/grandtheftroster/elements/Thrown.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ public Thrower getThrower(){

public void pushRight(){
body.setLinearVelocity(speed, body.getLinearVelocity().y);
//body.setAngularVelocity(-speed*314/(radius)); cut off rotation for chair implementation
}
public void pushLeft(){
body.setLinearVelocity(-speed, body.getLinearVelocity().y);
//body.setAngularVelocity(speed*314/(radius)); cut off rotation for chair implementation
}

public void addGroundContact(){
Expand All @@ -95,6 +93,7 @@ public void removeGroundConact(){
}
public int getGroundContact(){ return groundContact; }

@Override
public boolean destory(){
if(!super.destory()){ return false; }
if(thrower != null){
Expand Down
22 changes: 1 addition & 21 deletions src/grandtheftroster/handlers/GameStateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
* 2. The GSM is responsible to passing the render, update, dispose
* etc. commands from the application listener to whichever
* game-state is the current game-state.
*
*
* Change Log:
* 15.9.20gha: First Edition
*
*/

public class GameStateManager {
Expand Down Expand Up @@ -108,19 +103,4 @@ public void destoryAll(){
}
}

}















}
7 changes: 0 additions & 7 deletions src/grandtheftroster/handlers/Lvl1ContactListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
* will serve as an event handle for every collision.
* This gives a location to program what happens when
* collisions occur.
*
* Change Log:
* 15.9.21gha: First Edition
*
*/

public class Lvl1ContactListener implements ContactListener {
Expand All @@ -44,7 +40,6 @@ public void beginContact(Contact c) {
fixtures[0] = fixtures[1];
fixtures[1] = c.getFixtureA();
handleBeginContact(fixtures);

}

// called when two fixtures no longer collide
Expand Down Expand Up @@ -145,12 +140,10 @@ private void handlePostSolve(Fixture[] fixtures){
if(model0.hasTag("thrown") && model1.hasTag("platform, left")){
Thrown t = (Thrown) fixtures[0].getBody().getUserData();
t.pushLeft();
//t.addGroundContact();
}
else if(model0.hasTag("thrown") && model1.hasTag("platform, right")){
Thrown t = (Thrown) fixtures[0].getBody().getUserData();
t.pushRight();
//t.addGroundContact();
}
}
}
9 changes: 0 additions & 9 deletions src/grandtheftroster/handlers/Lvl2ContactListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
* will serve as an event handle for every collision.
* This gives a location to program what happens when
* collisions occur.
*
* Change Log:
* 15.9.21gha: First Edition
*
*/

public class Lvl2ContactListener implements ContactListener {
Expand Down Expand Up @@ -117,10 +113,5 @@ private void handleEndContact(Fixture[] fixtures){
private void handlePostSolve(Fixture[] fixtures){
if(!(fixtures[0].getBody().getUserData() instanceof Model) ||
!(fixtures[1].getBody().getUserData() instanceof Model)){ return; }
//Model model0 = (Model) fixtures[0].getBody().getUserData();
//Model model1 = (Model) fixtures[1].getBody().getUserData();



}
}
7 changes: 0 additions & 7 deletions src/grandtheftroster/handlers/Lvl3ContactListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
* will serve as an event handle for every collision.
* This gives a location to program what happens when
* collisions occur.
*
* Change Log:
* 15.9.21gha: First Edition
*
*/

public class Lvl3ContactListener implements ContactListener {
Expand Down Expand Up @@ -109,8 +105,5 @@ private void handleEndContact(Fixture[] fixtures){
private void handlePostSolve(Fixture[] fixtures){
if(!(fixtures[0].getBody().getUserData() instanceof Model) ||
!(fixtures[1].getBody().getUserData() instanceof Model)){ return; }
//Model model0 = (Model) fixtures[0].getBody().getUserData();
//Model model1 = (Model) fixtures[1].getBody().getUserData();

}
}
4 changes: 0 additions & 4 deletions src/grandtheftroster/handlers/MyInputProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
* calls on it as an event handle for input. The InPr makes
* changes to the static fields of MyInput to store data on
* the state of the buttons.
*
* Change Log:
* 15.9.21gha: First Edition
*
*/

public class MyInputProcessor extends InputAdapter {
Expand Down
21 changes: 16 additions & 5 deletions src/grandtheftroster/main/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
*
* In addition to the GSM, a few other important task are completed
* here such. Each task should be documented in-line.
*
* Change Log:
* 15.9.21gha: First edition
*
*/

public class Game implements ApplicationListener {
Expand Down Expand Up @@ -79,9 +75,10 @@ public void create() {
hudCamera.setToOrtho(false, V_WIDTH*SCALE, V_HEIGHT*SCALE);

gsm = new GameStateManager(this);
gsm.pushState(GameStateManager.SPLASH_SCREEN);
gsm.pushState(GameStateManager.LEVEL_ONE);
}
public void render() {
handleInput();
accum = Gdx.graphics.getDeltaTime();
gsm.update(accum);
gsm.render();
Expand All @@ -91,6 +88,7 @@ public void render() {
public void dispose() {
gsm.destoryAll();
}

public void resize(int w, int h) {}
public void pause() {}
public void resume() {}
Expand All @@ -113,4 +111,17 @@ private void loadAudio(){
playlist.addSound("Level 3", cfg.getProperty("LVL3BKG@PATHS:AUDIO"), 0.4f, true);
playlist.setVolume(0.4f);
}

private void handleInput(){
if(MyInput.isPressed(MyInput.BUTTON_1)){
gsm.setState(GameStateManager.LEVEL_ONE);
}
if(MyInput.isPressed(MyInput.BUTTON_2)){
gsm.setState(GameStateManager.LEVEL_TWO);
}
if(MyInput.isPressed(MyInput.BUTTON_3)){
gsm.setState(GameStateManager.LEVEL_THREE);
}

}
}
2 changes: 0 additions & 2 deletions src/grandtheftroster/player/Activity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package grandtheftroster.player;

import static grandtheftroster.elements.B2DVars.PPM;
import grandtheftroster.audio.AudioPlayer;
import grandtheftroster.elements.Model;
import grandtheftroster.handlers.AnimationManager;
import grandtheftroster.utilities.Configuration;
Expand Down Expand Up @@ -54,5 +53,4 @@ public void draw(SpriteBatch sb){
am.draw(sb, x, y);
}


}
2 changes: 0 additions & 2 deletions src/grandtheftroster/player/Hovering.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public class Hovering extends Activity{

private static final float SPEED = 0.01f;



public Hovering(Player p) {
super(p);
loadAnimations();
Expand Down
8 changes: 0 additions & 8 deletions src/grandtheftroster/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ public void handleEndContact(Model model){
ACTIVITY_SWINGING.handleEndContact(model);
ACTIVITY_SWINGING.handleEndContact(model);
//do any handleing needed in player

//if(actMan.getActivity()==ACTIVITY_HOVERING && model.hasTag("fan")){
// actMan.setActivity(ACTIVITY_WALKING);
//}



}

//Getters and Mutators
Expand Down Expand Up @@ -125,7 +118,6 @@ public void setActivity(Activity a){
activity.begin();
}
public Activity getActivity(){ return activity; }

}

}
Expand Down
6 changes: 2 additions & 4 deletions src/grandtheftroster/states/GameOverState.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ public class GameOverState extends GameState {
cfg.loadConfiguration("res/config/paths/audio paths.config");
}

private BitmapFont font;
private Texture wastedGraphic;
private Music backgroundMusic;

public GameOverState(GameStateManager gsm) {
super(gsm, "Game Over");
wastedGraphic = new Texture("res/images/failure_wasted/failure_wasted_ingame2x.png"); //wasted logo
font = new BitmapFont();
new BitmapFont();
backgroundMusic = Gdx.audio.newMusic(new FileHandle(cfg.getProperty("THEME@PATHS:AUDIO")));
backgroundMusic.setVolume(0.5f);
backgroundMusic.setLooping(true);
Expand Down Expand Up @@ -58,8 +57,7 @@ public void render() {

sb.setProjectionMatrix(hudCam.combined);
sb.begin(); //lives lost is a placeholder in case we give a power up that gives extra lives.
sb.draw(wastedGraphic, Game.V_WIDTH/2-wastedGraphic.getWidth()/2, Game.V_HEIGHT/3*2-wastedGraphic.getHeight()/2); //"wasted" graphic
//gfont16.draw("*** Game Over ***", GlyphFont.COLOR_WHITE, GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT*3/4); text-based "game over"
sb.draw(wastedGraphic, Game.V_WIDTH/2-wastedGraphic.getWidth()/2, Game.V_HEIGHT/3*2-wastedGraphic.getHeight()/2); //"wasted" graphic

int middleX = Game.V_WIDTH/2+16;
int middleY = Game.V_HEIGHT*2/3-16*4;
Expand Down
4 changes: 0 additions & 4 deletions src/grandtheftroster/states/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
* This is the superclass of all GameStates. It sets the interface
* that will exist between the Game State Manager and each Game State.
* Essential objects are already imported and instantiated.
*
* Change Log:
* 15.9.20gha: First Edition
*
*/

public abstract class GameState {
Expand Down
12 changes: 0 additions & 12 deletions src/grandtheftroster/states/InfoState.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.BitmapFont;




public class InfoState extends GameState {

//BitmapFont font;
//GlyphFont gfont;
public InfoState(GameStateManager gsm){
super(gsm, "Main Menu");
//font = new BitmapFont();
//gfont = new GlyphFont("res/images/retro font.png", 8, sb);
}

@Override
Expand All @@ -44,10 +39,6 @@ public void render() {
//SpriteBatch to GPU
sb.setProjectionMatrix(hudCam.combined);
sb.begin();
//font.draw(sb, "Main Menu", Game.V_WIDTH/2-35, Game.V_HEIGHT/2);
//font.draw(sb, "Press ENTER to continue.", 10, Game.V_HEIGHT-10);
//font.draw(sb, "Press ESC to quit.", 10, Game.V_HEIGHT-25);
//gfont16.draw("*Main Menu*", GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2+220);
gfont16.draw("Press ENTER to continue", GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2-180); //originally -10
gfont16.draw("Press ESC to quit", GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2-200); //originally -25
gfont16.draw("Controls:", GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2+20);
Expand All @@ -62,14 +53,11 @@ public void render() {
GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2+140);
gfont8.draw("to retrieve the class roster from the infamous ANKY.",
GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT/2+130);
//gfont16.draw("Hunter", GlyphFont.ALIGN_CENTER, Game.V_WIDTH/2, Game.V_HEIGHT-64-32);
for(Model i:models){
i.draw(sb);
}
sb.draw(cabFrame, 0, 0);
sb.end();


}

}
Loading

0 comments on commit 39f973b

Please sign in to comment.