等距渲染失败

时间:2013-02-07 08:48:53

标签: java swing awt java-2d

因此,我的等距看起来不正常,而不是像等距渲染一样。

这是我的抽奖代码

public class IsometricEntity extends Rectangle {
    private Graphics2D graphics;

    // tiles
    int tileSet[][];

    int tileWidth = 100;
    int tileHeight = 58;

    public IsometricEntity(Graphics2D graphics, float x, float y, float width, float height) {
        super(x, y, width, height);
        this.graphics = graphics;
        this.tileSet = new int[(int) (width / tileWidth)][(int) (height / tileHeight)];
    }

    public void update(float deltaTime) {
    }

    public void draw(float deltaTime) {
        for (int i = 0; i < tileSet.length; i++) {
            for (int j = tileSet[i].length; j >= 0; j--) {
                graphics.drawImage(Assets.dirtTile, (i * tileWidth) + (tileWidth/2), (j * tileHeight) + (tileHeight/2), Assets.dirtTile.getWidth(), Assets.dirtTile.getHeight(), null);
                graphics.drawImage(Assets.dirtTile, (i * tileWidth), (j * tileHeight), Assets.dirtTile.getWidth(), Assets.dirtTile.getHeight(), null);
            }
        }
    }
}

这是我得到的:

enter image description here

我该怎么做才能让它看起来像普通的等距地图?

我希望它看起来像第二个基本上是扁平的,没有脊上升

enter image description here

0 个答案:

没有答案