Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.iMackshun.Games.Pixelformer.Screens;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.InputProcessor;
- import com.badlogic.gdx.Screen;
- import com.badlogic.gdx.Input.Keys;
- import com.badlogic.gdx.graphics.GL10;
- import com.badlogic.gdx.graphics.g2d.Sprite;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.badlogic.gdx.graphics.g2d.TextureAtlas;
- import com.badlogic.gdx.graphics.g2d.TextureRegion;
- import com.iMackshun.Games.Pixelformer.PixelFormer;
- import com.iMackshun.Games.Pixelformer.Worlds.World1_1;
- public class World1Story implements Screen, InputProcessor{
- //Declarations
- PixelFormer game;
- TextureAtlas GUI = new TextureAtlas("packs/PixelFormerGUI.pack");
- TextureRegion Story1, Story2, Story3, Story4, Story5;
- Sprite Story;
- int WhichStory = 1;
- SpriteBatch batch;
- //Constructor
- public World1Story(PixelFormer game){
- this.game = game;
- }
- @Override
- public void render(float delta) {
- checkStory();
- Gdx.gl.glClearColor(0, 0, 0, 1);
- Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- batch.begin();
- Story.draw(batch);
- batch.end();
- }
- private void checkStory() {
- if (WhichStory == 1){
- Story.setRegion(Story1);
- }
- if (WhichStory == 2){
- Story.setRegion(Story2);
- }
- if (WhichStory == 3){
- Story.setRegion(Story3);
- }
- if (WhichStory == 4){
- Story.setRegion(Story4);
- }
- if (WhichStory == 5){
- Story.setRegion(Story5);
- }
- if (WhichStory == 6){
- game.setScreen(new World1_1(game));
- }
- }
- @Override
- public void resize(int width, int height) {
- Gdx.app.log(PixelFormer.LOG, "Menu. Awesome!!!!!");
- Gdx.input.setInputProcessor(this);
- }
- @Override
- public void show() {
- //Resources
- batch = new SpriteBatch();
- Story1 = new TextureRegion(GUI.findRegion("Story1to1"));
- Story2 = new TextureRegion(GUI.findRegion("Story1to2"));
- Story3 = new TextureRegion(GUI.findRegion("Story1to3"));
- Story4 = new TextureRegion(GUI.findRegion("Story1to4"));
- Story5 = new TextureRegion(GUI.findRegion("Story1to5"));
- Story = new Sprite(Story2);
- }
- @Override
- public void hide() {
- // TODO Auto-generated method stub
- }
- @Override
- public void pause() {
- // TODO Auto-generated method stub
- }
- @Override
- public void resume() {
- // TODO Auto-generated method stub
- }
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
- }
- @Override
- public boolean keyDown(int keycode) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean keyUp(int keycode) {
- if(keycode == Keys.DPAD_CENTER){
- WhichStory += 1;
- }
- if(keycode == Keys.ENTER){
- WhichStory += 1;
- }
- return false;
- }
- @Override
- public boolean keyTyped(char character) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean touchDown(int screenX, int screenY, int pointer, int button) {
- WhichStory += 1;
- return false;
- }
- @Override
- public boolean touchUp(int screenX, int screenY, int pointer, int button) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean touchDragged(int screenX, int screenY, int pointer) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean mouseMoved(int screenX, int screenY) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public boolean scrolled(int amount) {
- // TODO Auto-generated method stub
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment