Page 1 of 1

The proper way to add custom tiles?

PostPosted: 12 Dec 2018, 01:28
by njamnjam
Hi!
I want to build my own tileset, and I know that it is possible, though I have no idea how to do that. To use my own tileset I have to build .strf file and inside tiles.strf file it is mentioned that: "the meaning of the values in (attributes ...) can be seen in src/tile.cpp, unisolid is 3 not 2", but there is no such file in that folder.
My version of the Supertux2 is current stable 0.5.1

Re: The proper way to add custom tiles?

PostPosted: 13 Dec 2018, 01:48
by ProTux
I do not know, But i recommend you ask manuel because he knows alot of things.

Re: The proper way to add custom tiles?

PostPosted: 14 Dec 2018, 17:17
by WeLuvGoatz
The reason that there is no file in that folder is because you have not built the game from source. I have no clue how to do any of this, but this is how it works. If you want to download the file, you can find it in the source code at github.com/supertux/supertux somewhere. Don't fret, I'm currently trying to make a custom tilemap myself so I'll update you as I work on it. :)

Re: The proper way to add custom tiles?

PostPosted: 15 Dec 2018, 15:00
by manuel
Normal tiles are defined by a the filename they are found, how many 32*32px images are in there (width and height), their ids, and their attributes.

{l Code}: {l Select All Code}
(tiles
    (width 3)
    (height 3)
    (ids
      301 302 303
      304 305 306
      307 308 309
    )
    (attributes
      0 0 0
      1 1 1
      1 1 1
    )
    (image "tiles/jungle/convex.png")
  )


Attributes are 0 for unsolid, 1 for solid and 1024 for hurting. Slopes have the attribute 17.

If you want to have slopes or unisolid tiles, additional to the attributes you need a data tag:

{l Code}: {l Select All Code}
(tiles
    (width 3)
    (height 3)
    (ids
      301 302 303
      304 305 306
      307 308 309
    )
    (attributes
      0 0 0
      1 17 17
      1 17 17
    )
    (data
     0 0 0
     0 2 0
     0 1 3
    )
    (image "tiles/jungle/convex.png")
  )


If a tile (solid, unsolid, hurting) doesn't require a data-tag, leave it 0.
Here's a small cheatsheet for the data tags. Red is the attribute, blue is the data. If there's no blue number you don't need to add a data tag if none of the tiles in your image needs one.

I hope this helps :)