net.petterroea.starterkit
Class Tile

java.lang.Object
  extended by net.petterroea.starterkit.Tile

public class Tile
extends java.lang.Object

A tile.

Author:
petterroea

Field Summary
 boolean collidesWithParticles
          True if the tile collides with particles
 boolean collidesWithPlayer
          True if the tile is collidable with a player object
 int gridx
          Where the tile is in the tile grid(x coordinate)
 int gridy
          Where the tile is in the tile grid(y coordinate)
 
Constructor Summary
Tile(int gridx, int gridy)
          Constructor for a tile.
 
Method Summary
 boolean collidesWith(Entity ent)
          Checks if the tile collides with the specific entity
 java.awt.image.BufferedImage getTile(Map map)
          This is used for getting a specific tile sprite image.
 boolean use()
          Override this if you want this to be "usable"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gridx

public int gridx
Where the tile is in the tile grid(x coordinate)


gridy

public int gridy
Where the tile is in the tile grid(y coordinate)


collidesWithPlayer

public boolean collidesWithPlayer
True if the tile is collidable with a player object


collidesWithParticles

public boolean collidesWithParticles
True if the tile collides with particles

Constructor Detail

Tile

public Tile(int gridx,
            int gridy)
Constructor for a tile. Override this!

Method Detail

getTile

public java.awt.image.BufferedImage getTile(Map map)
This is used for getting a specific tile sprite image. I added parameters for more advanced users who wants more advanced games, which allows you to get the tiles close to this tile and calculate the sprite from that.

Parameters:
map - So you can get if there are tiles nearby, and make it use a sprite that fits for ajacent sprites
Returns:
The image

collidesWith

public boolean collidesWith(Entity ent)
Checks if the tile collides with the specific entity

Parameters:
ent - The entity to check with. Use "ent instanceof NAMEOFYOURENTITYCLASS" to check if the entity is a specific entity
Returns:
True if the tile collides with that entity

use

public boolean use()
Override this if you want this to be "usable"

Returns:
True if it is used. This blocks further tiles nearby to be processed.