Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package com.wyvern.pp.states;
  2.  
  3.  
  4. import com.badlogic.gdx.Gdx;
  5. import com.badlogic.gdx.Input;
  6. import com.badlogic.gdx.graphics.Texture;
  7. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  8. import com.wyvern.pp.PPlane;
  9.  
  10.  
  11. public class PlayState extends State{
  12. private boolean peripheralAvailable;
  13.  
  14. private Texture walls;
  15. private Texture bg;
  16. private Texture plane;
  17.  
  18.  
  19.  
  20. public PlayState(GameStateManager gsm) {
  21. super(gsm);
  22.  
  23.  
  24. walls = new Texture("walls.png");
  25. bg = new Texture("bg.png");
  26. plane = new Texture("plane_left.png");
  27.  
  28. cam.setToOrtho(true);
  29.  
  30. peripheralAvailable = Gdx.input.isPeripheralAvailable(Input.Peripheral.Accelerometer);
  31. }
  32.  
  33. @Override
  34. protected void handleInput() {
  35.  
  36.  
  37.  
  38. }
  39.  
  40. @Override
  41. public void update(float dt) {
  42. handleInput();
  43.  
  44. float xRot;
  45. if(peripheralAvailable) {
  46. xRot = Gdx.input.getAccelerometerX();
  47.  
  48. }
  49.  
  50.  
  51. }
  52.  
  53. @Override
  54. public void render(SpriteBatch sb) {
  55. sb.begin();
  56. sb.draw(bg, 0, 0, PPlane.WIDTH, PPlane.HEIGHT);
  57. sb.draw(walls, 0, 0);
  58. sb.draw(plane, xRot, 15 ); // gives an error
  59. sb.draw(walls, PPlane.WIDTH - walls.getWidth(), 0);
  60. sb.end();
  61. }
  62.  
  63. @Override
  64. public void dispose() {
  65.  
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement