Guest User

WaterTile

a guest
Jun 29th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. ..
  2. public class WaterTile extends Tile {
  3.  
  4.     private int anim;
  5.  
  6.     public WaterTile(Sprite sprite) {
  7.         super(sprite);
  8.     }
  9.  
  10.     public void render(int x, int y, Screen screen) {
  11.         screen.renderTile(x << 4, y << 4, this);
  12.     }
  13.    
  14.     public void update() {
  15.         if (anim < 1000000)
  16.             anim++;
  17.         else
  18.             anim = 0;
  19.        
  20.         if(anim % 30 > 20) {
  21.             sprite = Sprite.water_;
  22.         } else {
  23.             sprite = Sprite.water;
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment