SHARE
TWEET

Untitled

a guest Nov 20th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.kingclub2.jelly.gametypes;
  2.  
  3. import com.badlogic.gdx.Gdx;
  4. import com.badlogic.gdx.Screen;
  5. import com.badlogic.gdx.graphics.GL20;
  6. import com.badlogic.gdx.graphics.OrthographicCamera;
  7. import com.kingclub2.jelly.Ghost;
  8. import com.kingclub2.jelly.GhostInput;
  9. import com.kingclub2.jelly.GhostType;
  10. import com.kingclub2.jelly.Human;
  11. import com.kingclub2kingclub2.jelly.JellyGame;
  12.  
  13. public class SpookScreen implements Screen {
  14.  
  15.     final JellyGame game;
  16.     Ghost ghost;
  17.     GhostType type;
  18.     Human human;
  19.     float speed = 50;
  20.     OrthographicCamera camera;
  21.  
  22.     public SpookScreen(final JellyGame game) {
  23.         this.game = game;
  24.         this.type = GhostType.Spooky;
  25.         camera = new OrthographicCamera();
  26.         camera.setToOrtho(false, 640, 480);
  27.         ghost = game.makeGhost(type, 320, 240);
  28.         human = game.makeSpookedHuman(100, 100);
  29.     }
  30.  
  31.     @Override
  32.     public void show() {
  33.         Gdx.input.setInputProcessor(new GhostInput(ghost, this.speed));
  34.     }
  35.  
  36.     @Override
  37.     public void render(float delta) {
  38.         Gdx.gl.glClearColor(0, 0, 0, 1);
  39.         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  40.        
  41.         camera.update();
  42.         game.batch.setProjectionMatrix(camera.combined);
  43.        
  44.         ghost.update(delta);
  45.         human.update(delta);
  46.  
  47.         game.batch.begin();
  48.         human.draw(game.batch);
  49.         ghost.draw(game.batch);
  50.         game.batch.end();
  51.  
  52.     }
  53.  
  54.     @Override
  55.     public void resize(int width, int height) {
  56.         System.out.println(String.format("width: %s, height: %s", width, height));
  57.         //camera.viewportWidth = width;
  58.         //camera.viewportHeight = height;
  59.         camera.update();
  60.     }
  61.  
  62.     @Override
  63.     public void pause() {
  64.  
  65.     }
  66.  
  67.     @Override
  68.     public void resume() {
  69.  
  70.     }
  71.  
  72.     @Override
  73.     public void hide() {
  74.  
  75.     }
  76.  
  77.     @Override
  78.     public void dispose() {
  79.     }
  80.  
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top