Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entity.TileRect points to wrong tileset region when using Tile Property #12

Open
TLINDEN opened this issue Mar 31, 2024 · 0 comments
Open

Comments

@TLINDEN
Copy link

TLINDEN commented Mar 31, 2024

Ok, so I have a tile setup which looks like this:

ldtk-entity-def

The entiy in question is a switch, its sprite is the close switch (red). As long as I had it only that way, it rendered in the game as expected. However, then I added a Tile Property, as can be seen in the screenshot. In the game I load both sprites into different variables, but BOTH now point the SAME region in the tileset. When I render both sprites in the game it looks like this:

samesprites

When I dump the entity.TileRect without the tile property, I get:

2024-03-31T07:20.13 CEST DEBUG: LOAD TILE /home/scip/dev/openquell/game/levels.go: 188 
    isdoor: false           
    isswitch: true        
    name: Switch          
    tileid: 7d975370-d7b0-11ee-9add-971995295000
    tilerect:             
        x: 96             <== 
        y: 160            <==
        w: 32             
        h: 32             
        tilesetuid: 57  

With the property I get:

2024-03-31T07:17.01 CEST DEBUG: LOAD TILE /home/scip/dev/openquell/game/levels.go: 188 
    isdoor: false   
    isswitch: true         
    name: Switch
    tileid: 7d975370-d7b0-11ee-9add-971995295000
    tilerect:               
        x: 96   <==
        y: 192  <==
        w: 32                   
        h: 32   
        tilesetuid: 57
    tileref: 81e502b0-d7b0-11ee-9add-6193c766edeb
    togglerect:        
        x: 96   <== This is the location of the tile property sprite
        y: 192  <== 
        w: 32          
        h: 32   

This is the tileset:
tileset

However, I managed to "fix" this behavior by customizing the Display Setting of the property. By default it's value is Replace entity tile. When I set it like so:

display

then everything works as expected.

Please correct me if I'm wrong, but in my opinion this is a bug: ldtkgo should not consider the display settings. I think these are meant for the LDTK UI only, not for the resulting game. Now that I know how to circumvent this, it's no real problem. But it took me a while to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant