Пример #1
0
  /**
   * Takes the map data are returns a Texture that can be drawn from a sprite.
   *
   * @param width How wide in pixels you want the returned Texture to be.
   * @param height How high in pixels you want the returned Texture to be.
   * @return a Texture that is width x height big that can then be drawn to the screen
   * @throws TextureCreationException
   */
  ConstTexture drawMap() {
    int currentSlot = 0;
    screen.clear();
    for (int x = 0; x < XSize; x++) {
      for (int y = 0; y < YSize; y++) {
        currentTile.setPosition(x * 16, y * 16);
        currentTile.setTexture(textures.tiles.get(textureMap.get(currentSlot)));
        screen.draw(currentTile);
        currentSlot++;
      }
    }
    screen.display();

    return screen.getTexture();
  }
Пример #2
0
 void setOrigin(Vector2f vec) {
   sprite.setOrigin(vec);
 }
Пример #3
0
 void setPosition(int x, int y) {
   sprite.setPosition(x, y);
 }
Пример #4
0
 OSprite(Texture texture) {
   sprite = new Sprite();
   sprite.setTexture(texture);
 }
Пример #5
0
 public int getY() {
   return (int) itemSprite.getPosition().y;
 };
Пример #6
0
 public int getX() {
   return (int) itemSprite.getPosition().x;
 }; // for collison dector