Examples of Sprite


Examples of games.stendhal.client.sprite.Sprite

  //

  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    Sprite sprite;
    if (entity.getType().equals("useable_entity")) {
      if (entity.getName() == null) {
        sprite = store.getSprite(translate("signs/transparent"));
      } else {
        sprite = store.getSprite(translate("useable/" + getClassResourcePath() + "/" + entity.getName()));
      }
    } else {
      // compatiblity with 0.86 server
      sprite = store.getSprite(translate("useable/source/" + entity.getType()));
    }

    /*
     * Entities are [currently] always 1x1. Extra columns are animation.
     * Extra rows are ignored.
     */
    final int imageWidth = sprite.getWidth();
    final int width = Math.max((int) entity.getWidth(), 1);
    final int height = Math.max((int) entity.getHeight(), 1);
    int frames = imageWidth / IGameScreen.SIZE_UNIT_PIXELS / width;
   
    // Just use the normal sprite if there are no animation frames
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

  @Override
  protected void buildSprites(final Map<Object, Sprite> map,
      final Sprite tiles, final int width, final int height) {
    final SpriteStore store = SpriteStore.get();

    final Sprite right = store.getTile(tiles, 0, 0, width, height);
    final Sprite left = store.getTile(tiles, 0, height, width, height);

    map.put(Direction.RIGHT, right);
    map.put(Direction.LEFT, left);
    map.put(Direction.UP, right);
    map.put(Direction.DOWN, left);
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Build the visual representation of this entity.
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    Sprite sprite = store.getSprite(translate(getClassResourcePath()));
    setSprite(sprite);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * @param entity
   * @return The appropriate sprite for the current state.
   */
  protected Sprite getStateSprite(IEntity entity) {
    final Object state = getState(entity);
    final Sprite sprite = getSprite(state);

    if (sprite == null) {
      logger.debug("No sprite found for: " + state);
      return SpriteStore.get().getFailsafe();
    }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   *
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    final Sprite tiles = store.getSprite(translate(getClassResourcePath()));

    working = store.getTile(tiles, 0, 0, IGameScreen.SIZE_UNIT_PIXELS,
        IGameScreen.SIZE_UNIT_PIXELS);
    broken = store.getTile(tiles, 0, IGameScreen.SIZE_UNIT_PIXELS,
        IGameScreen.SIZE_UNIT_PIXELS, IGameScreen.SIZE_UNIT_PIXELS);
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Build the visual representation of this entity.
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    Sprite sprite = store.getSprite(translate(getClassResourcePath()));

    /*
     * Items are always 1x1 (they need to fit in entity slots). Extra
     * columns are animation. Extra rows are ignored.
     */
    final int width = sprite.getWidth();

    if (width > IGameScreen.SIZE_UNIT_PIXELS) {
      sprite = store.getAnimatedSprite(sprite, 0, 0, width
          / IGameScreen.SIZE_UNIT_PIXELS,
          IGameScreen.SIZE_UNIT_PIXELS, IGameScreen.SIZE_UNIT_PIXELS,
          100);
    } else if (sprite.getHeight() > IGameScreen.SIZE_UNIT_PIXELS) {
      sprite = store.getTile(sprite, 0, 0, IGameScreen.SIZE_UNIT_PIXELS,
          IGameScreen.SIZE_UNIT_PIXELS);
      logger.warn("Multi-row item image for: " + getClassResourcePath());
    }

View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

    if (name == null) {
      width = IGameScreen.SIZE_UNIT_PIXELS;
      height = IGameScreen.SIZE_UNIT_PIXELS;

      final Sprite emptySprite = store.getEmptySprite(width, height);

      map.put(STATE_OPEN, emptySprite);
      map.put(STATE_CLOSED, emptySprite);
    } else {
      final Sprite tiles = store.getSprite(translate(name));

      width = tiles.getWidth();
      height = tiles.getHeight() / 2;

      map.put(STATE_OPEN, store.getTile(tiles, 0, 0, width, height));
      map.put(STATE_CLOSED, store
          .getTile(tiles, 0, height, width, height));
    }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

    itemClass.setSelectedItem(actual.getItemClass());
    itemSubclass.setText(actual.getItemSubclass());
    String gfxLocation = "/" + actual.getItemClass() + "/"
        + actual.getItemSubclass() + ".png";
    Sprite spr = SpriteStore.get().getSprite(
        "stendhal/data/sprites/items" + gfxLocation);

    drawSinglePart(spr, 1, 1, imageResource.getGraphics());
    itemGFXLocation.setText(gfxLocation);
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

        + (int) actual.getHeight());
    creatureTileid.setText(actual.getTileId().replace(
        "../../tileset/logic/creature/", ""));
    String gfxLocation = "/" + actual.getCreatureClass() + "/"
        + actual.getCreatureSubclass() + ".png";
    Sprite spr = SpriteStore.get().getSprite(
        "stendhal/data/sprites/monsters" + gfxLocation);

    drawSinglePart(spr, actual.getWidth(), actual.getHeight(),
        creatureImage.getGraphics());
    creatureGFXLocation.setText(gfxLocation);
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

    try {
      String clazz = (String) creatureClass.getSelectedItem();
      String subclass = creatureSubclass.getText();

      String gfxLocation = "/" + clazz + "/" + subclass + ".png";
      Sprite spr = SpriteStore.get().getSprite(
          "data/sprites/monsters" + gfxLocation);
      String[] sizes = creatureSize.getText().split(",");

      drawSinglePart(spr, Integer.parseInt(sizes[0]),
          Integer.parseInt(sizes[1]), creatureImage.getGraphics());
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.