added test character drawing

This commit is contained in:
Sem van der Hoeven
2020-05-27 21:17:09 +02:00
parent 1f6e229d79
commit 9ddf94589b
11 changed files with 88 additions and 5 deletions

View File

@@ -6,11 +6,21 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import netwerkprog.game.client.game.characters.Agent;
import netwerkprog.game.client.game.characters.Hacker;
import netwerkprog.game.client.game.characters.abilities.BodySwap;
import netwerkprog.game.client.game.characters.abilities.Implant;
import netwerkprog.game.client.game.characters.abilities.Scrambler;
import netwerkprog.game.client.game.map.Map;
import netwerkprog.game.client.game.map.MapRenderer;
import netwerkprog.game.client.game.map.GameInputProcessor;
import netwerkprog.game.util.game.Character;
import netwerkprog.game.util.graphics.FrameRate;
import netwerkprog.game.util.tree.BST;
public class MainGame extends ApplicationAdapter{
SpriteBatch batch;
@@ -24,6 +34,9 @@ public class MainGame extends ApplicationAdapter{
private Map map;
public MapRenderer mapRenderer;
private BST<Character> tree;
public Character testCharacter;
@Override
@@ -58,6 +71,9 @@ public class MainGame extends ApplicationAdapter{
camera.viewportWidth = screenWidth / 2;
camera.viewportHeight = screenHeight / 2;
camera.update();
this.tree = new BST<>();
initCharaters();
// this.tree.insert(new Hacker(,new BodySwap()));
// playSong();
@@ -66,6 +82,14 @@ public class MainGame extends ApplicationAdapter{
// connectToServer();
}
private void initCharaters() {
Texture texture = new Texture(Gdx.files.internal("core/assets/characters.png"));
TextureRegion[][] characters = TextureRegion.split(texture,32,32);
this.testCharacter = new Hacker(characters[1][0],new BodySwap("test"));
this.tree.insert(testCharacter);
this.tree.insert(new Agent(characters[2][0],new Implant("test")));
}
private void playSong() {
// play music
@@ -144,5 +168,8 @@ public class MainGame extends ApplicationAdapter{
return map.getWidth();
}
public BST<Character> getTree() {
return tree;
}
}