Advertisement
Guest User

Mob

a guest
Jun 13th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package com.thecherno.rain.entity.mob;
  2.  
  3. import com.thecherno.rain.entity.Entity;
  4. import com.thecherno.rain.graphics.Sprite;
  5.  
  6. public abstract class Mob extends Entity{
  7.    
  8.     protected Sprite sprite;
  9.     protected int dir = 0;
  10.     protected boolean moving = false;
  11.    
  12.     public void move(int xa, int ya) {
  13.         if (xa > 0) dir = 1;
  14.         if (xa < 0) dir = 3;
  15.         if (ya > 0) dir = 2;
  16.         if (ya < 0) dir = 0;
  17.        
  18.         if (!collision()) {
  19.             x += xa;
  20.             y += ya;
  21.         }
  22.     }
  23.    
  24.     public void update() {
  25.     }
  26.    
  27.     private boolean collision() {
  28.         return false;
  29.     }
  30.    
  31.     public void render() {
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement