Examples of SpriteSheet


Examples of org.newdawn.slick.SpriteSheet

   * @param sprite
   * @return
   */
  public Image getSprite(Direction dir, boolean isMoving, boolean isLeftFoot,
      int sprite) {
    SpriteSheet sheet = spriteSheets.get(sprite);
    if (isMoving) {
      if (isLeftFoot) {
        switch (dir) {
        case Up:
          return sheet.getSprite(0, 0);
        case Down:
          return sheet.getSprite(0, 2);
        case Left:
          return sheet.getSprite(0, 3);
        case Right:
          return sheet.getSprite(0, 1);
        }
      } else {
        switch (dir) {
        case Up:
          return sheet.getSprite(2, 0);
        case Down:
          return sheet.getSprite(2, 2);
        case Left:
          return sheet.getSprite(2, 3);
        case Right:
          return sheet.getSprite(2, 1);
        }
      }
    } else {
      switch (dir) {
      case Up:
        return sheet.getSprite(1, 0);
      case Down:
        return sheet.getSprite(1, 2);
      case Left:
        return sheet.getSprite(1, 3);
      case Right:
        return sheet.getSprite(1, 1);
      }
    }
    return null;
  }
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

      String respath = System.getProperty("res.path");
      if (respath == null)
        respath = "";
      Image temp;
      Image[] imgArray = new Image[250];
      SpriteSheet ss = null;
      /*
       * WARNING: Change 224 to the amount of sprites we have in client
       * the load bar only works when we don't make a new SpriteSheet ie.
       * ss = new SpriteSheet(temp, 41, 51); needs to be commented out in
       * order for the load bar to work.
       */
      for (int i = -5; i < 224; i++) {
        try {
          location = respath + "res/characters/" + String.valueOf(i)
              + ".png";
          temp = new Image(location);
          imgArray[i + 5] = temp;
          ss = new SpriteSheet(temp, 41, 51);

          spriteSheets.put(i, ss);
        } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

  public SpriteFactory(Image[] imgArray) {
    spriteSheets = new HashMap<Integer, SpriteSheet>();

    for (int i = -5; i < 224; i++) {
      spriteSheets.put(i, new SpriteSheet(imgArray[i + 5], 41, 51));
    }
  }
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

  }

  @Override
  public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
   
    SpriteSheet sheet = new SpriteSheet("data/corphish.png", 60, 60);
    Animation anim = new Animation(sheet, 300);
   
    players.add(new PlayerStatus("player1",anim, 30, 30));
   
    selfStatus = players.get(0);
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

   * Set the image to use for this sprite sheet image to use for this tileset
   *
   * @param image The image to use for this tileset
   */
  public void setTileSetImage(Image image) {
    tiles = new SpriteSheet(image, tileWidth, tileHeight, tileSpacing, tileMargin);
    tilesAcross = tiles.getHorizontalCount();
    tilesDown = tiles.getVerticalCount();

    if (tilesAcross <= 0) {
      tilesAcross = 1;
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

    this.y = y;
   
      // load the sprites and tiles, note that underneath the texture
        // will be shared between the sprite sheet and tilemap
      // x e y dell'animazione!
        sheet = new SpriteSheet(percorsoSpriteSheet,dimSHX, dimSHY);
       
        // animazione
        setPlayerWalkUp(setAnimationFromSheet(sheet,rigaUp,startNumAnimazioni,numAnimazioni));
        setPlayerWalkRight(setAnimationFromSheet(sheet,rigaRight,startNumAnimazioni,numAnimazioni));
        setPlayerWalkDown(setAnimationFromSheet(sheet,rigaDown,startNumAnimazioni,numAnimazioni));
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

    this.y = y;
   
      // load the sprites and tiles, note that underneath the texture
        // will be shared between the sprite sheet and tilemap
      // x e y dell'animazione!
        sheet = new SpriteSheet(percorsoSpriteSheet,dimSHX, dimSHY);
       
        // animazione movimento
        setAnimWalkUp(setAnimationFromSheet(sheet,rigaUp,startNumAnimazioni,numAnimazioni));
        setAnimWalkRight(setAnimationFromSheet(sheet,rigaRight,startNumAnimazioni,numAnimazioni));
        setAnimWalkDown(setAnimationFromSheet(sheet,rigaDown,startNumAnimazioni,numAnimazioni));
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

    this.y = y;
   
      // load the sprites and tiles, note that underneath the texture
        // will be shared between the sprite sheet and tilemap
      // x e y dell'animazione!
        sheet = new SpriteSheet(percorsoSpriteSheet,dimSHX, dimSHY);
       
        // animazione movimento
        setAnimWalkUp(setAnimationFromSheet(sheet,rigaUp,startNumAnimazioni,numAnimazioni));
        setAnimWalkRight(setAnimationFromSheet(sheet,rigaRight,startNumAnimazioni,numAnimazioni));
        setAnimWalkDown(setAnimationFromSheet(sheet,rigaDown,startNumAnimazioni,numAnimazioni));
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

    this.y = y;
   
      // load the sprites and tiles, note that underneath the texture
        // will be shared between the sprite sheet and tilemap
      // x e y dell'animazione!
        sheet = new SpriteSheet(percorsoSpriteSheet,dimSHX, dimSHY);
       
        // animazione
        setAnimWalkUp(setAnimationFromSheet(sheet,rigaUp,startNumAnimazioni,numAnimazioni));
        setAnimWalkRight(setAnimationFromSheet(sheet,rigaRight,startNumAnimazioni,numAnimazioni));
        setAnimWalkDown(setAnimationFromSheet(sheet,rigaDown,startNumAnimazioni,numAnimazioni));
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

   
    public Sprite addSprite(String path, int w, int h,SpriteModel model){
        Sprite sprite=new Sprite();
       
        try{
            SpriteSheet sheet=new SpriteSheet(path,w,h);
           
            sprite.model=model;
            sprite.addAnimation(sheet, 100);
           
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.