archer graphic added - no function yet

master
GammelJan 6 years ago
parent 26a486a8f4
commit d2360cb338

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

@ -13,27 +13,31 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.dungeoncrawler.view.View;
import com.dungeoncrawler.model.Dungeon;
import com.dungeoncrawler.model.entities.Player;
import com.dungeoncrawler.model.entities.Archer;
public class Controller extends ApplicationAdapter implements InputProcessor{
SpriteBatch batch;
Dungeon d;
View v;
Player p;
Player p;
Archer a;
float movementX = 0f;
float movementY = 0f;
@Override
public void create(){
batch = new SpriteBatch();
v = new View();
p = new Player(0,0,0);
p = new Player(0,0,1);
d = new Dungeon(p);
a = new Archer(500, 200, 1);
Gdx.input.setInputProcessor(this);
}
@Override
public void render(){
v.render(batch, movementX ,movementY);
v.render(batch, movementX ,movementY, a.getxPos(), a.getyPos());
}
@Override
@ -45,23 +49,26 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
public boolean keyDown(int keycode) {
if(keycode == Input.Keys.LEFT){
movementX = -3f;
v.render(batch, movementX, movementY);
v.render(batch, movementX, movementY, a.getxPos(), a.getyPos());
}
if(keycode == Input.Keys.RIGHT){
movementX = 3f;
v.render(batch, movementX, movementY);
v.render(batch, movementX, movementY, a.getxPos(), a.getyPos());
}
if(keycode == Input.Keys.UP){
movementY = 3f;
v.render(batch, movementX, movementY);
movementY = 2f;
v.render(batch, movementX, movementY, a.getxPos(), a.getyPos());
}
if(keycode == Input.Keys.DOWN){
movementY = -3f;
v.render(batch, movementX, movementY);
movementY = -2f;
v.render(batch, movementX, movementY, a.getxPos(), a.getyPos());
}
if(keycode == Input.Keys.W){
}
return true;
}

@ -14,4 +14,6 @@ public class Archer extends Entity{
// TODO: Sinnvolle Werte finden
}
}

@ -24,4 +24,6 @@ public class Player extends Entity {
// TODO: Sinnvolle Werte finden
}
}

@ -12,9 +12,11 @@ public class View {
Texture b;
Texture t;
Texture p;
Texture a;
Sprite button;
Sprite title;
Sprite player;
Sprite archer;
int frame = 0;
int zeile = 0;
TextureRegion[][] regions;
@ -27,8 +29,10 @@ public class View {
b = new Texture("Button.png");
t = new Texture("Title.png");
p = new Texture("animplay.png");
a = new Texture("Archer.png");
button = new Sprite(b);
title = new Sprite(t);
archer = new Sprite(a);
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
@ -129,12 +133,13 @@ public class View {
}
public void render (SpriteBatch batch, float x, float y) {
public void render (SpriteBatch batch, float x, float y, int archerX, int archerY) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
player.setX(player.getX()+x);
player.setY(player.getY()+y);
archer.setX(archerX);
archer.setY(archerY);
if(x == 3f){
trechts.start();
if(player.isFlipX() == true){
@ -161,6 +166,7 @@ public class View {
title.draw(batch);
button.draw(batch);
player.draw(batch);
archer.draw(batch);
batch.end();
}

Loading…
Cancel
Save