Tile offset drawing mishaps

Posts: 67
Joined: 2006.06
Post: #1
Not quite sure what is happening.




Tile is very simple:
import java.awt.image.BufferedImage;

public class Tile {
    private BufferedImage image;
    private String type;
    public Tile(BufferedImage image, String type)    {
        this.image = image;
        this.type = type;
    public Tile()    {
    public BufferedImage getImage()    {
        return image;
    public void setImage(BufferedImage image)    {
        this.image = image;
    public String getType()    {
        return type;
    public void setType(String type)    {
        this.type = type;

The problem is offset I think, If i remove all use of the variable offset, the tilemap draws the first row fine but gets null pointers on line 118 if I am not mistaken.

The original problem is that they either do not draw with BIT_TILE_SIZE or whatever set to 8 (as it should be) and if i lower it to 7, or 6 it draws the tiles but spaced terribly.

This exact same code has worked fantastically for me before, perhaps I just need a larger map, ill try that and get back with more acutal details and maybe perhaps a question.

That is insane. If the map is OVER a certain size which I am not aware of, it draws prefectly fine, however if it is smaller it just gets lots of nul pointers. If someone had time or was feeling nice *E*D* they could tell me why smaller tilemaps make it get confused. I really dont see why.


private static final int TILE_SIZE = 64;
// the size in bits of the tile
// Math.pow(2, TILE_SIZE_BITS) == TILE_SIZE
private static final int TILE_SIZE_BITS = 6;

Shouldnt TILE_SIZE_BITS have to be 8 to work correctly? If it is it fails there are massive black areas between the tiles.

The machine does not run without the coin.
Quote this message in a reply
Post Reply