Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wyvern.pp.states;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.Input;
- import com.badlogic.gdx.graphics.Texture;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.wyvern.pp.PPlane;
- public class PlayState extends State{
- private boolean peripheralAvailable;
- private Texture walls;
- private Texture bg;
- private Texture plane;
- public PlayState(GameStateManager gsm) {
- super(gsm);
- walls = new Texture("walls.png");
- bg = new Texture("bg.png");
- plane = new Texture("plane_left.png");
- cam.setToOrtho(true);
- peripheralAvailable = Gdx.input.isPeripheralAvailable(Input.Peripheral.Accelerometer);
- }
- @Override
- protected void handleInput() {
- }
- @Override
- public void update(float dt) {
- handleInput();
- float xRot;
- if(peripheralAvailable) {
- xRot = Gdx.input.getAccelerometerX();
- }
- }
- @Override
- public void render(SpriteBatch sb) {
- sb.begin();
- sb.draw(bg, 0, 0, PPlane.WIDTH, PPlane.HEIGHT);
- sb.draw(walls, 0, 0);
- sb.draw(plane, xRot, 15 ); // gives an error
- sb.draw(walls, PPlane.WIDTH - walls.getWidth(), 0);
- sb.end();
- }
- @Override
- public void dispose() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement