Skip to content
Snippets Groups Projects
Commit a2a7f323 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

#5 Creatures proper Z depth

parent f7e571c2
Branches
Tags
No related merge requests found
......@@ -16,6 +16,7 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.Align;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
......@@ -29,7 +30,6 @@ public class GameScreen extends ScreenAdapter {
private class GameBackground extends Actor {
private Texture backgroundTexture;
private Texture sceneTexture;
private Texture sceneHelperTexture;
public GameBackground() {
......@@ -37,8 +37,6 @@ public class GameScreen extends ScreenAdapter {
backgroundTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
sceneHelperTexture = BankRoberryAssetManager.getInstance().get(BankRoberryAssetManager.SCREEN_NEWSSTAND_BOTTOM_S5, Texture.class);
sceneHelperTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
sceneTexture = BankRoberryAssetManager.getInstance().get(BankRoberryAssetManager.SCREEN_NEWSSTAND_S5, Texture.class);
sceneTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
@Override
......@@ -47,6 +45,21 @@ public class GameScreen extends ScreenAdapter {
batch.draw(backgroundTexture, getX(), getY(), Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.enableBlending();
batch.draw(sceneHelperTexture, getX(), getY(), Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
}
private class GameForeground extends Actor {
private Texture sceneTexture;
public GameForeground() {
sceneTexture = BankRoberryAssetManager.getInstance().get(BankRoberryAssetManager.SCREEN_NEWSSTAND_S5, Texture.class);
sceneTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
@Override
public void draw(Batch batch, float parentAlpha) {
batch.draw(sceneTexture, getX(), getY(), Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
......@@ -65,6 +78,8 @@ public class GameScreen extends ScreenAdapter {
private final static Interpolation CREATURE_MIDDLE_INTERPOLATION = Interpolation.pow4In;
private final static Interpolation CREATURE_FINISH_INTERPOLATION = Interpolation.linear;
private final Group creatureLayer = new Group();
private float creatureStartPositionX;
private float creatureStartPositionY;
private float creatureMiddle1PositionX;
......@@ -81,7 +96,11 @@ public class GameScreen extends ScreenAdapter {
@Override
public void show() {
stage = new Stage(new ScreenViewport(), new SpriteBatch());
stage.addActor(new GameBackground());
stage.addActor(creatureLayer);
stage.addActor(new GameForeground());
stage.setDebugAll(true);
prepareCreaturePositions(stage.getViewport().getWorldWidth(), stage.getViewport().getWorldHeight());
......@@ -148,7 +167,7 @@ public class GameScreen extends ScreenAdapter {
showNextCreature(creatures);
}
})));
stage.addActor(creature);
creatureLayer.addActor(creature);
// IModifierListener<IEntity> firstAnimListener = new EntityModifierListenerAdapter() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment