First Commit
This commit is contained in:
23
com/jalenwinslow/game/utils/Assets.java
Normal file
23
com/jalenwinslow/game/utils/Assets.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.jalenwinslow.game.utils;
|
||||
|
||||
import com.badlogic.gdx.Files;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g3d.utils.TextureProvider;
|
||||
|
||||
/**
|
||||
* Created by jalen on --/--/----.
|
||||
*/
|
||||
|
||||
public class Assets {
|
||||
|
||||
|
||||
|
||||
public static void init() {
|
||||
|
||||
}
|
||||
|
||||
public static void dispose() {
|
||||
|
||||
}
|
||||
}
|
63
com/jalenwinslow/game/utils/CamHandler.java
Normal file
63
com/jalenwinslow/game/utils/CamHandler.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.jalenwinslow.game.utils;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.jalenwinslow.game.Handler;
|
||||
import com.jalenwinslow.game.gameobjects.GameObject;
|
||||
|
||||
/**
|
||||
* Created by jalen on --/--/----.
|
||||
*/
|
||||
|
||||
public class CamHandler {
|
||||
|
||||
private Handler handler;
|
||||
private OrthographicCamera cam;
|
||||
private float x, y;
|
||||
private float speed, acceleration;
|
||||
private GameObject objOfFocus;
|
||||
private boolean manual;
|
||||
|
||||
public CamHandler(Handler handler, OrthographicCamera cam, GameObject objOfFocus) {
|
||||
this.handler = handler;
|
||||
this.cam = cam;
|
||||
speed = 5;
|
||||
acceleration = 0;
|
||||
this.objOfFocus = objOfFocus;
|
||||
manual = false;
|
||||
}
|
||||
|
||||
public void update(float dt) {
|
||||
|
||||
if (objOfFocus != null && !manual) {
|
||||
x = objOfFocus.getPos().x;
|
||||
y = objOfFocus.getPos().y;
|
||||
}
|
||||
|
||||
//check collision out of game area
|
||||
gameSidesCollision();
|
||||
|
||||
//Update camera
|
||||
cam.position.set(x, y, 0);
|
||||
}
|
||||
|
||||
private void gameSidesCollision() {
|
||||
if (x - Gdx.graphics.getWidth()/24 < 0) {x = Gdx.graphics.getWidth()/24;} // check left side of screen
|
||||
if (x + Gdx.graphics.getWidth()/24 > handler.getGoHandler().getMaze().getMazeWidth()) {
|
||||
x = handler.getGoHandler().getMaze().getMazeWidth() - Gdx.graphics.getWidth()/24;
|
||||
}
|
||||
if (y - Gdx.graphics.getHeight()/24 < 0) {y = Gdx.graphics.getHeight()/24;}
|
||||
if (y + Gdx.graphics.getHeight()/24 >= handler.getGoHandler().getMaze().getMazeHeight()) {
|
||||
y = handler.getGoHandler().getMaze().getMazeHeight() - Gdx.graphics.getHeight()/24;
|
||||
}
|
||||
}
|
||||
|
||||
//Getters and Setters
|
||||
public OrthographicCamera getCamera() {return cam;}
|
||||
public GameObject getObjOfFocus() {return objOfFocus;}
|
||||
public boolean isManual() {return manual;}
|
||||
|
||||
public void setCamera(OrthographicCamera cam) {this.cam = cam;}
|
||||
public void setObjOfFocus(GameObject objOfFocus) {this.objOfFocus = objOfFocus;}
|
||||
public void setManual(boolean manual) {this.manual = manual;}
|
||||
}
|
16
com/jalenwinslow/game/utils/Controls.java
Normal file
16
com/jalenwinslow/game/utils/Controls.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.jalenwinslow.game.utils;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
/**
|
||||
* Updated by jalen on 6/17/2018.
|
||||
*/
|
||||
|
||||
public class Controls {
|
||||
|
||||
|
||||
public static void update(float dt) {
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user