Advertisement
dermetfan

SonnyCh DrawableBox2D suggestion

Nov 3rd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public abstract class DrawableBox2D extends Box2DSprite implements Comparable<DrawableBox2D> {
  2.  
  3.     Body body;
  4.    
  5.     public abstract void interact();
  6.    
  7.     public DrawableBox2D(TextureRegion initialSprite) {
  8.         super(initialSprite);
  9.         // if this is how you apply the unit scale you won't need it anymore
  10.         // this.setScaleX(SuikoTestGame.scale);
  11.         // this.setScaleY(SuikoTestGame.scale);
  12.     }
  13.    
  14.     @Override
  15.     public void draw(Batch spriteBatch) {
  16.         draw(spriteBatch, body);
  17.     }
  18.    
  19.     @Override
  20.     public int compareTo(DrawableBox2D arg0) {
  21.         return Float.compare(arg0.body.getPosition().y, this.body.getPosition().y);
  22.     }
  23.    
  24.     @Override
  25.     public float getY() {
  26.         return this.body.getPosition().y;
  27.     }
  28.    
  29.     @Override
  30.     public float getX() {
  31.         return this.body.getPosition().x;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement