title: trying to make my (very simple) libgdx game more object-oriented. added GameObject class - game doesn't launch anymore
body: <p>what the title says. </p>
  
  <p>first of all, here are my 3 classes:</p>
  
  <p><strong>MyGdxGame</strong>:</p>
  
  <pre><code>package com.mygdx.game;
  
  import com.badlogic.gdx.ApplicationAdapter;
  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.InputProcessor;
  import com.badlogic.gdx.graphics.GL20;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.g2d.Sprite;
  import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  
  public class MyGdxGame extends ApplicationAdapter {
      SpriteBatch batch;
      Sprite sp; 
      Texture img;
      int width;
      int height; 
      Player p;
  
      @Override
      public void create () {
          batch = new SpriteBatch();
          img = new Texture("dildo.png");
          sp = new Sprite(img); 
          width = Gdx.graphics.getWidth();
          height = Gdx.graphics.getHeight();
          p = new Player(img);
          Gdx.input.setInputProcessor(p);
  
      }
  
      @Override
      public void render () {
          //sp.flip(true, false);
          p.update();
          Gdx.gl.glClearColor(255,255,255,255);
          Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
          batch.begin();
          //batch.draw(img, 0, height/6, -img.getWidth(), img.getHeight());
          p.draw(batch);
          //sp.draw(batch); 
          batch.end();
      }
      }
  </code></pre>
  
  <p><strong>Player</strong>:</p>
  
  <pre><code>package com.mygdx.game;
  
  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.InputProcessor;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.g2d.Sprite;
  import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  import com.badlogic.gdx.math.Vector2;
  import com.badlogic.gdx.utils.TimeUtils;
  
  public class Player extends GameObject implements InputProcessor {
  
      private Sprite sp;
      private Texture te;
      private float xPos;
      private float yPos;
      private float xSpeed;
      private float ySpeed;
      private float accelerationX;
      private float g;
      Vector2 position;
      private float accelerationJump = 9f;
      private boolean allowJump = true;
      private boolean isDragged = false;
  
          public Player(Texture sprite) {
          xPos = 0;
          yPos = (super.getHeight()/6);
          xSpeed = 5.5f;
          ySpeed = 0;
          te = sprite;
          sp.setX(xPos);
          sp.setY(yPos);
          g = 0.2f;
          accelerationX=0.02f;
  
      }
  
      public void update() {
          ySpeed -= g;
  
          if(isDragged) {
              xSpeed += accelerationX;
              moveBy(xSpeed,0);
              isDragged = false;
          }
  
          if (getxPos() &gt; super.getWidth()) {
              setxPos(0);
          } else {
              moveBy(xSpeed, ySpeed);
          }
  
          if (getyPos() &lt; super.getHeight() / 6) {
              moveTo(sp.getX(), getHeight() / 6);
          }
          if (onGround()) {
              allowJump = true;
              ySpeed = 0;
          }
      }
  
      public void jump() {
          ySpeed += accelerationJump;
      }
  
      public boolean onGround() {
          return (sp.getY() == super.getHeight()/6);
      }
  
      @Override
      public boolean keyDown(int keycode) {
          return false;
      }
  
      @Override
      public boolean keyUp(int keycode) {
          return false;
      }
  
      @Override
      public boolean keyTyped(char character) {
          return false;
      }
  
      @Override
      public boolean touchDown(int screenX, int screenY, int pointer, int button) {
  
          return true;
      }
  
      @Override
      public boolean touchUp(int screenX, int screenY, int pointer, int button) {
          if (allowJump &amp;&amp; isDragged == false) {
              allowJump = false;
              jump(); 
          }
          return false;
      }
  
      @Override
      public boolean touchDragged(int screenX, int screenY, int pointer) {
          if(isDragged==false) {
          isDragged = true;
          }
          return false;
      }
  
      @Override
      public boolean mouseMoved(int screenX, int screenY) {
          return false;
      }
  
      @Override
      public boolean scrolled(int amount) {
          return false;
      }
  }
  </code></pre>
  
  <p><strong>GameObject</strong>:</p>
  
  <pre><code>package com.mygdx.game;
  
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.g2d.Sprite;
  import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  
  public abstract class GameObject {
  
      private Sprite sp;
  
      private int width;
  
      private int height;
  
      private float xPos;
  
      private float yPos;
  
      private float xSpeed;
  
      private float ySpeed;
  
      public GameObject(int width, int height) {
          this.width = width;
          this.height = height;
      }
  
      public GameObject() {
  
      }
  
      public void moveTo(float xPos2, float yPos2) {
          setxPos(xPos2);
          setyPos(yPos2);
      }
  
      public void moveBy(float dx, float dy) {
          sp.setY(sp.getY() + dy);
          sp.setX(sp.getX() + dx);
      }
  
      public float getxPos() {
          return xPos;
      }
  
      public float getyPos() {
          return yPos;
      }
  
      public void setxPos(float xPos2) {
          sp.setX(xPos2);
      }
  
      public void setyPos(float yPos) {
          sp.setY(yPos);
      }
  
      public float getxSpeed() {
          return xSpeed;
      }
  
      public float getySpeed() {
          return ySpeed;
      }
  
      public void setxSpeed(float xSpeed2) {
          xSpeed = xSpeed2;
      }
  
      public void setySpeed(float ySpeed2) {
          ySpeed = ySpeed2;
      }
  
      public int getWidth() {
          return width;
      }
  
      public int getHeight() {
          return height
      }
  
      public void draw(SpriteBatch batch) {
          sp.draw(batch);
      }
  
  }
  </code></pre>
  
  <p>basically, the game as it is now is just a sprite moving from left to right of the screen - when you tap, it jumps, when you drag the screen it dashes forward. i want to now start adding things like power-ups and platforms so i thought it would be a good idea to create a GameObject class. but now when i run it the screen goes black and the application just crashes, i have a feeling it has something to do with the way i'm initialising my Texture? any ideas?</p>
  
  <p>any help is highly appreciated, many thanks in advance :)</p>
  
  <p>edit: in GameObject constructor width and height are the width and height of the screen</p>