Package org.newdawn.slick

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


   
    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

   * 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

     *
     * @param ref String - Ruta de la imagen.
     */
    private void setupAnimations(final String ref) {
        try {
            setGraphic(new SpriteSheet(ref, this.width, this.height));
            addAnimation(STAND_DOWN, false, 0, 0);
            addAnimation(STAND_RIGHT, false, 0, 1);
            addAnimation(STAND_UP, false, 0, 2);
            addAnimation(STAND_LEFT, false, 0, 3);
        } catch (SlickException ex) {
View Full Code Here

     * @see it.marteEngine.actor.TopDownActor#setupAnimations
     */
    @Override
    public void setupAnimations(final String ref) {
        try {
            setGraphic(new SpriteSheet(ref, 42, 57));
            duration = 250;
            addAnimation(STAND_DOWN, false, 0, 0);
            addAnimation(STAND_UP, false, 0, 6);
            addAnimation(STAND_RIGHT, false, 0, 3);
            addAnimation(STAND_LEFT, false, 0, 9);
View Full Code Here

    }

    Log.debug(String.format(
        "Loading spritesheet key=%s file=%s width=%s height=%s", key,
        file, width, height));
    ResourceManager.addSpriteSheet(key, new SpriteSheet(baseDir + file,
        width, height, transparentColor));
  }
View Full Code Here

    if (!ResourceManager.hasSpriteSheet(imgName)) {
      throw new IllegalArgumentException("Animation " + key
          + " needs spritesheet " + imgName
          + " but it has not been loaded.");
    }
    SpriteSheet sheet = ResourceManager.getSpriteSheet(imgName);

    if (element.hasAttribute("frames")) {
      String framesAsText = element.getAttribute("frames");
      frames = readFrameIndexes(framesAsText);
    } else {
      frames = new int[sheet.getHorizontalCount()];
      for (int i = 0; i < sheet.getHorizontalCount(); i++) {
        frames[i] = i;
      }
    }
    if (element.hasAttribute("flipHorizontal")) {
      flipHorizontal = parseBooleanAttribute(element, "flipHorizontal");
View Full Code Here

    if (!ResourceManager.hasSpriteSheet(imgName)) {
      throw new IllegalArgumentException("Spritesheetfont " + key
          + " needs spritesheet " + imgName
          + " but it has not been loaded.");
    }
    SpriteSheet sheet = ResourceManager.getSpriteSheet(imgName);

    Log.debug(formatLoadMsg("SpriteSheet font", key, imgName));
    SpriteSheetFont font = new SpriteSheetFont(sheet, startingChar);
    ResourceManager.addFont(key, font);
  }
View Full Code Here

    }
  }

  private void setupAnimations(String ref, int row, int frame) {
    try {
      setGraphic(new SpriteSheet(ref, width, height));
      addAnimation(NAME, false, row, frame);
    } catch (SlickException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    define(ME.WALK_RIGHT, Input.KEY_RIGHT, Input.KEY_D);
  }

  public void setupAnimations(String ref) {
    try {
      setGraphic(new SpriteSheet(ref, WIDTH, HEIGHT));
      duration = 150;
      addAnimation(STAND_DOWN, false, 0, 0);
      addAnimation(ME.WALK_DOWN, true, 0, 0, 1, 2, 3, 4, 5, 6, 7);
      addAnimation(ME.WALK_UP, true, 1, 0, 1, 2, 3, 4, 5, 6, 7);
      addAnimation(ME.WALK_RIGHT, true, 2, 0, 1, 2, 3, 4, 5);
View Full Code Here

TOP

Related Classes of org.newdawn.slick.SpriteSheet

Copyright © 2018 www.massapicom. 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.