Characters moving #9
@@ -3,6 +3,7 @@ package netwerkprog.game.client;
|
|||||||
import com.badlogic.gdx.ApplicationAdapter;
|
import com.badlogic.gdx.ApplicationAdapter;
|
||||||
import com.badlogic.gdx.Files;
|
import com.badlogic.gdx.Files;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.audio.Music;
|
import com.badlogic.gdx.audio.Music;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
@@ -45,9 +46,9 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
private GAMESTATE gamestate;
|
private GAMESTATE gamestate;
|
||||||
private Faction chosenFaction;
|
private Faction chosenFaction;
|
||||||
|
|
||||||
|
|
||||||
private Map map;
|
private Map map;
|
||||||
public MapRenderer mapRenderer;
|
public MapRenderer mapRenderer;
|
||||||
|
public AssetManager assets;
|
||||||
|
|
||||||
private static MainGame INSTANCE;
|
private static MainGame INSTANCE;
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
textRenderer = new TextRenderer();
|
textRenderer = new TextRenderer();
|
||||||
font = new BitmapFont();
|
font = new BitmapFont();
|
||||||
layout = new GlyphLayout();
|
layout = new GlyphLayout();
|
||||||
|
assets = new AssetManager();
|
||||||
|
|
||||||
String[] strings = new String[]{
|
String[] strings = new String[]{
|
||||||
"#########################",
|
"#########################",
|
||||||
@@ -107,7 +109,9 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initCharacters() {
|
public void initCharacters() {
|
||||||
Texture texture = new Texture(Gdx.files.internal("core/assets/characters.png"));
|
assets.load("core/assets/characters.png",Texture.class);
|
||||||
|
assets.finishLoading();
|
||||||
|
Texture texture = assets.get("core/assets/characters.png");
|
||||||
TextureRegion[][] characters = TextureRegion.split(texture, 32, 32);
|
TextureRegion[][] characters = TextureRegion.split(texture, 32, 32);
|
||||||
this.team = new Team();
|
this.team = new Team();
|
||||||
|
|
||||||
@@ -216,6 +220,7 @@ public class MainGame extends ApplicationAdapter {
|
|||||||
public void dispose() {
|
public void dispose() {
|
||||||
batch.dispose();
|
batch.dispose();
|
||||||
textRenderer.dispose();
|
textRenderer.dispose();
|
||||||
|
assets.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getScreenWidth() {
|
public float getScreenWidth() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Texture;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
import netwerkprog.game.client.MainGame;
|
import netwerkprog.game.client.MainGame;
|
||||||
import netwerkprog.game.util.game.GameCharacter;
|
import netwerkprog.game.util.game.GameCharacter;
|
||||||
import netwerkprog.game.util.graphics.Renderable;
|
import netwerkprog.game.util.graphics.Renderable;
|
||||||
@@ -57,8 +58,6 @@ public class MapRenderer implements Renderable {
|
|||||||
this.camera = camera;
|
this.camera = camera;
|
||||||
this.mainGame = MainGame.getInstance();
|
this.mainGame = MainGame.getInstance();
|
||||||
font = new BitmapFont();
|
font = new BitmapFont();
|
||||||
square = new Texture(Gdx.files.internal("square.png"));
|
|
||||||
square2 = new Texture(Gdx.files.internal("square2.png"));
|
|
||||||
makeTiles();
|
makeTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +65,14 @@ public class MapRenderer implements Renderable {
|
|||||||
* loads all the images for the tiles and adds all the tiles to the array
|
* loads all the images for the tiles and adds all the tiles to the array
|
||||||
*/
|
*/
|
||||||
private void makeTiles() {
|
private void makeTiles() {
|
||||||
Texture texture = new Texture(Gdx.files.internal(tilePath));
|
mainGame.assets.load("square.png", Texture.class);
|
||||||
|
mainGame.assets.load("square2.png", Texture.class);
|
||||||
|
mainGame.assets.load(tilePath, Texture.class);
|
||||||
|
mainGame.assets.finishLoading();
|
||||||
|
square = mainGame.assets.get("square.png");
|
||||||
|
square2 = mainGame.assets.get("square2.png");
|
||||||
|
|
||||||
|
Texture texture = mainGame.assets.get(tilePath);
|
||||||
TextureRegion[][] tileTextures = TextureRegion.split(texture, 32, 32);
|
TextureRegion[][] tileTextures = TextureRegion.split(texture, 32, 32);
|
||||||
|
|
||||||
FLOOR_TILE = tileTextures[1][6];
|
FLOOR_TILE = tileTextures[1][6];
|
||||||
@@ -196,4 +202,5 @@ public class MapRenderer implements Renderable {
|
|||||||
public List<GameTile> getSurroundedTilesOfCurrentCharacter() {
|
public List<GameTile> getSurroundedTilesOfCurrentCharacter() {
|
||||||
return surroundedTilesOfCurrentCharacter;
|
return surroundedTilesOfCurrentCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user