Anim8

Movement Algor

Aug 17th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. import com.anim8.stats.health;
  2.  
  3. public class character {
  4.     static renderer rend = new renderer();
  5.     static randomGen rand = new randomGen();
  6.     private static int charX, charY;
  7.     private static int charBoundsX = 320;
  8.     private static int charBoundsY = 343;
  9.    
  10.     public static int getCharX(){
  11.         return charX;
  12.     }
  13.    
  14.     public static int getCharY(){
  15.         return charY;
  16.     }
  17.    
  18.     private static boolean charSunglasses = false;
  19.     private static int moveSpeed = 1;
  20.     private static int maxTimer = 100;
  21.    
  22.    
  23.     private static Boolean youCanMove = false;
  24.    
  25.     static timerUpdate tu = new timerUpdate();
  26.     public static void canIMove(){
  27.        
  28.         if(tu.updateTimer(moveSpeed, maxTimer)==true){
  29.             moveCharacter();
  30.         }
  31.        
  32.     }
  33.    
  34.    
  35.  
  36.     public static void moveCharacter(){
  37.         charX = rand.getRandomNumber(charBoundsX);
  38.         charY = rand.getRandomNumber(charBoundsY);
  39.     }
  40.    
  41.     public static void updateCharacter(){
  42.         if(charSunglasses == true){
  43.             rend.readyTexture("sunglasses");
  44.  
  45.         } else {
  46.             rend.readyTexture("normal");
  47.            
  48.         }
  49.        
  50.         rend.tileRender(charX,charY,2);
  51.        
  52.  
  53.        
  54.        
  55.    
  56.        
  57.         //health.getHealth();
  58.     }
  59.    
  60.     public static void drawCharacter(){
  61.         mousePos mouse = new mousePos();
  62.         //charX = (int) mouse.mousePosX();
  63.         //charY = (int) mouse.mousePosY();
  64.        
  65.         updateCharacter();
  66.        
  67.        
  68.         canIMove();
  69.        
  70.         System.out.println("Time: " + main.getTime());
  71.        
  72.     }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment