Skip to content

Tiled map is drawn shifted one column to the left #415

@SirGnip

Description

@SirGnip

Bug Report

Actual behavior:

When I create a map with Tiled and draw it on the screen without any offsets/scrolling/scaling, the map is offset one column to the left, meaning the left-most column of tiles (stack of boxes in this case) is off screen:

image

Expected behavior:

When drawing a map in Arcade (without any offset/scrolling/scaling), I expect the origin of the map to be the bottom-left corner of the Arcade window. The origin of the map should match the origin of the window.

image

Steps to reproduce/example code:

Here is the example code I used to generate the "Actual behavior" screenshot. Uncomment the loop to see the expected results.

import arcade

class MyGame(arcade.Window):
    def __init__(self):
        super().__init__(600, 600, "Tiled Map Off-by-one Repro")
        arcade.set_background_color(arcade.csscolor.CORNFLOWER_BLUE)

    def setup(self):
        map = arcade.read_tiled_map('map.tmx', 1.0)
        self.wall_list = arcade.generate_sprites(map, 'Platforms', 1.0)
        # for s in self.wall_list.sprite_list:
        #     s.center_x += 128

    def on_draw(self):
        arcade.start_render()
        self.wall_list.draw()

    def update(self, delta_time):
        self.wall_list.update()

def main():
    window = MyGame()
    window.setup()
    arcade.run()

if __name__ == "__main__":
    main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions