Examples of SpriteSheet


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

     *
     * @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

Examples of org.newdawn.slick.SpriteSheet

     * @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

Examples of org.newdawn.slick.SpriteSheet

    }

    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

Examples of org.newdawn.slick.SpriteSheet

    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

Examples of org.newdawn.slick.SpriteSheet

    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

Examples of org.newdawn.slick.SpriteSheet

    }
  }

  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

Examples of org.newdawn.slick.SpriteSheet

    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

Examples of org.newdawn.slick.SpriteSheet

  @Override
  public void init(GameContainer container) throws SlickException {
    land = new Image("textures/land.jpg");
    plane = new Image("textures/plane.png");
    SpriteSheet sheet = new SpriteSheet("textures/sprites.png", 32, 32);
    sprites = sheet.getSprite(1, 0);
  }
View Full Code Here

Examples of org.newdawn.slick.SpriteSheet

    }
  }

  public Animation animation(String string) {
    try {
      return new Animation(new SpriteSheet(fRootDir + "/" + string + ".png", 32, 32), 100);
    } catch (Exception e) {
      System.err.println("Couldn't find resource: " + string);
      return null;
    }
  }
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.