Tips for drawing tilesets

Thanks Caleb!

Ok, I understood that the 4px spacing is for one tile only (total 8) :wink:

Now I made 64x64 tiles with spacing 4px and no margin. But…

Please, could you check the pic below. Everything seems to work fine but with iPhone5 the tile proportions are weird. Also with iPad and iPad retina.

problem2.jpg

Hm… That looks weird. What are your scaling options in your config.lua? What’s your screen size in config.lua?

  • Caleb

application = {
    content = {
        width = 640,
        height = 960,
        scale = “letterBox”,
        fps = 30,
        audioPlayFrequency = 22050,

        
        imageSuffix = {
                ["@2x"] = 2,
        },
        
    }
 
}

Do you have an @2x tileset as well as your normal one?

  • Caleb

Well, I’ve tried everything :wink: Tried with or without @2x-file.

Could you please check attached project. It’s very simple: http://aatosmedia.fi/tmp/dusktest.zip

Don’t know what is the proper way to do this, but what do you think about this:

  1. Draw tileset (tile 64x64): tileset@2x.png  (spacing 8px)    (for retina)
  2. Reduced tile size to 32x32: tileset.png (spacing 4px)
  3. Made a new Tiled project with tile 32x32 and spacing 4.

Caleb - I really appreciate your help :slight_smile:

Ok, I think I’ve figured it out. This is because Dusk tries to auto-scale objects to fit the screen. To disable this, comment out line #146 of Dusk/dusk_core/layer/tilelayer.lua, or set your config scale mode to “none”. I’ll see if I can add a non-manual fix for this to Dusk in the future.

  • Caleb

Thanks Caleb! That was the case indeed.

If I set the

map.setCameraFocus(mario) map.setTrackingLevel(0.1)

I can see sometimes blinking lines. I’ve set the spacing (4 px for 32x32 tiles and 8px for @2x tiles) and set the texture filter

display.setDefault("minTextureFilter", "nearest") display.setDefault("magTextureFilter", "nearest")

You once mentioned, that there is also one more thing you can do OR is the problem that I’m using physics?

Is this on device, or on the simulator? The simulator sometimes shows blinking lines, but not usually the device.

As long as you have a fairly recent version of Dusk, have your tiles set to static body type, have spacing, and have the correct texture filter, you should be ok.

  • Caleb

Tested on device and it works perfectly :slight_smile: