Tile offset drawing mishaps

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

TileMap:
http://rafb.net/paste/results/mxJ5wG56.html

ResourceManager:
http://rafb.net/paste/results/6GTN4j86.html

TileMapRenderer:
http://rafb.net/paste/results/5zrwiQ83.html

Tile is very simple:
Code:
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.




*edit*

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