The proper way to add custom tiles?

The proper way to add custom tiles?

Postby njamnjam » 12 Dec 2018, 01:28

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
njamnjam
 
Posts: 1
Joined: 12 Dec 2018, 01:09

Re: The proper way to add custom tiles?

Postby ProTux » 13 Dec 2018, 01:48

I do not know, But i recommend you ask manuel because he knows alot of things.
im back
ProTux
 
Posts: 115
Joined: 04 Nov 2018, 15:27
Location: the world

Re: The proper way to add custom tiles?

Postby WeLuvGoatz » 14 Dec 2018, 17:17

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. :)
No.
User avatar
WeLuvGoatz
SuperTux Moderator
 
Posts: 232
Joined: 23 May 2018, 19:15

Re: The proper way to add custom tiles?

Postby manuel » 15 Dec 2018, 15:00

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 :)
Attachments
st2-help.png
manuel
 
Posts: 190
Joined: 19 Sep 2017, 09:03

Who is online

Users browsing this forum: No registered users and 0 guests