merge conflicts solved

master
GammelJAN 5 years ago
commit 5f2b06d6fb

@ -11,7 +11,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
*/
public class AnimatedSprite {
private final static int[] rowLengths = {7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 6, 6, 12, 12, 12, 12, 6};
private final static int[] ROWLENGTHS = {7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 6, 6, 12, 12, 12, 12, 6};
private Sprite sprite;
private TextureRegion[][] texture;
@ -34,7 +34,7 @@ public class AnimatedSprite {
if(this.delta >= 0.1f) {
this.delta = 0;
if(getFrame() >= rowLengths[getRow()] - 1){
if(getFrame() >= ROWLENGTHS[getRow()] - 1){
setFrame(0);
}
else{

@ -10,6 +10,9 @@ public class Main extends Game{
/**
* TODO: set final Value for World
*/
// 0: normal game world, 1: dialogue, 2: fight
public static int gamestate = 0;
@Override
public void create () {

@ -51,23 +51,31 @@ public class Player extends Actor{
@Override
public void act(float delta) {
if(Gdx.input.isKeyPressed(Input.Keys.D)){
movementX = speed;
facing = 3;
}
if(Gdx.input.isKeyPressed(Input.Keys.A)){
movementX = -speed;
facing = 1;
}
if(Gdx.input.isKeyPressed(Input.Keys.W)){
movementY = speed;
facing = 0;
}
if(Gdx.input.isKeyPressed(Input.Keys.S)){
movementY = -speed;
facing = 2;
}
if(Main.gamestate == 0) {
if(Gdx.input.isKeyPressed(Input.Keys.D)){
movementX = speed;
facing = 3;
}
if(Gdx.input.isKeyPressed(Input.Keys.A)){
movementX = -speed;
facing = 1;
}
if(Gdx.input.isKeyPressed(Input.Keys.W)){
movementY = speed;
facing = 0;
}
if(Gdx.input.isKeyPressed(Input.Keys.S)){
movementY = -speed;
facing = 2;
}
if(Gdx.input.isKeyJustPressed(Input.Keys.E)) {
Main.gamestate = 1;
getStage().addActor(new Textbox("Dies ist eine coole Test Textbox", "Feier ich", "Ehre"));
}
}
else if(Main.gamestate == 1) {
// Input handled by invoked textbox
}
/**
* return
* 0: only vertical movement available

@ -103,8 +103,6 @@ public class Textbox extends Actor{
@Override
public void draw(Batch batch, float parentAlpha) {
if(!batch.isDrawing()){
batch.begin();}
if(state == 0){
for(int i = 0; i < splitted.size(); i++){
if(i == printLine){
@ -130,7 +128,6 @@ public class Textbox extends Actor{
font.draw(batch, asw2, 0.6f * r.getWidth(), getX() + getHeight() - splitted.size() * 1.2f * getTextHeight("A"));
font.setColor(Color.BLACK);
}
batch.end();
super.draw(batch, parentAlpha);
}

@ -38,8 +38,6 @@ public abstract class AbstractScreen implements Screen{
Gdx.input.setInputProcessor(stage);
}
public abstract void setTextbox(Textbox t);
@Override
public abstract void show();

@ -20,6 +20,7 @@ import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.trs.main.Main;
import com.trs.main.MapCollisionObject;
import com.trs.main.Player;
import com.trs.main.Textbox;
@ -31,8 +32,6 @@ import java.util.ArrayList;
*/
public class GameScreen extends AbstractScreen{
boolean textbox = false;
TmxMapLoader maploader;
TiledMap map;
@ -57,12 +56,6 @@ public class GameScreen extends AbstractScreen{
}
}
@Override
public void setTextbox(Textbox t) {
stage.addActor(t);
textbox = true;
}
@Override
public void show() {
}
@ -75,21 +68,18 @@ public class GameScreen extends AbstractScreen{
renderer.render();
if(!textbox){
stage.act(f);
stage.draw();
}
else{
stage.act(f);
stage.draw();
if(Main.gamestate == 1) {
Textbox t = null;
for(Actor a : stage.getActors()){
if(a.getName().equals("textbox")){
a.act(f);
a.draw(stage.getBatch(), CAMERA_WIDTH);
t = (Textbox)a;
if(t.getState() == 2){
a.remove();
Main.gamestate = 0;
t.getSelectedAsw(); // DO STUFF NICENICE
textbox = false;
}
}
}

Loading…
Cancel
Save