Unit.java :  » Game » androidwars64 » com » androidwars » Android Open Source

Android Open Source » Game » androidwars64 
androidwars64 » com » androidwars » Unit.java
package com.androidwars;

import com.stickycoding.rokon.Sprite;
import com.stickycoding.rokon.Texture;
import com.stickycoding.rokon.TextureAtlas;

public class Unit extends Sprite{
  
//  private int moveAllowance; //not being used yet
  private double xPos; //the x position of the unit
  private double yPos; //the y position of the unit
  private Texture picture;
  public static TextureAtlas atlas;
//  private int owner; //what player owns this unit
    
  public Unit(float xPos, float yPos, float width, float height){
    super(xPos, yPos, width, height);
    
    
  /*  picture = new Texture("bob.png");
    
    atlas = new TextureAtlas(); // Create a texture atlas to store your textures.
    atlas.insert(picture); // Add the background texture to the atlas.
    atlas.complete();
  */
  }
  
  //Usage: x = unit.getXPos();
  //Before: x is a double.
  //After: the x position of unit is contained in x.
  public double getXPos(){
    return xPos;
  }
  
  //Usage: y = unit.getYPos();
  //Before: y is a double.
  //After: the y position of unit is contained in y.
  public double getYPos(){
    return yPos;
  }
  
  //Usage: unit.setXPos(newXPos);
  //Before: newXPos is a double.
  //After: the new xPos of unit is now equal to newXPos.
  public void setXPos(int newXPos){
    xPos = newXPos;
  }
  
  //Usage: unit.setYPos(newYPos);
  //Before: newYPos is a double.
  //After: the new yPos of unit is now equal to newYPos.
  public void setYPos(int newYPos){
    yPos = newYPos;
  }    
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.