How can I use custom tiles in the editor?

How can I use custom tiles in the editor?

Postby Lolkat » 05 Aug 2014, 21:45

Some current addons have custom tiles and worldmap tiles on their levels and I was wondering how I can do this. I've also seen people use Mr. Juicebox/Cherrybomb but I can't access him in the level editor. Thanks in advance
User avatar
Lolkat
 
Posts: 27
Joined: 23 Jul 2013, 04:42

Re: How can I use custom tiles in the editor?

Postby SuperMat » 06 Aug 2014, 08:06

You can't in the editor, afaik, but you should be able to add some other object and edit its name in a text editor.
OS: Arch Linux/OS X Yosemite (10.10)
IRC: mt/mteufel @ freenode
SuperMat
 
Posts: 51
Joined: 20 Jan 2012, 19:19
Location: /home/mteufel

Re: How can I use custom tiles in the editor?

Postby cats12 » 06 Aug 2014, 09:06

Not too sure about custom tiles, but for worldmap tiles, creating an empty level and saving it as a .stwm should work (open it once, then close it and open it again for it to fully convert to a worldmap, IIRC).

For Mr. Juicebox and Cherrybomb, you just have to change a Mr. Bomb's SpriteFile (this option can be found on the bottom part of the window when selecting a badguy). This might not work if you aren't using the latest editor.
cats12
 
Posts: 4
Joined: 30 May 2014, 17:07

Re: How can I use custom tiles in the editor?

Postby LMH » 09 Aug 2014, 21:48

Changing to worldmap using the editor: Select File->Properties, the property at the bottom of the screen should be "TilesetFile" change this to "worldmap.strf" or "ice_world.strf" to have the editor automatically change into worldmap mode. I think you still need to save and then re-open the worldmap to ensure the graphics are all updated. I'd suggest doing this only with a new (empty) level, as otherwise could cause some funky behavior. Also, I think you will have to manually delete the spawn point and replace it with a worldmap spawn point. The worldmap spawn point should be in the objects menu (where you find badguys normally, it looks like a penguin) which should be populated with worldmap objects instead of regular level objects.

Note that you cannot currently test worldmaps using the "play" feature of the editor.

Using custom tiles: This is a bit more tricky, but still doable in the editor. First you will need to generate a tile-mapping file. These are normally located in data/images/ and have the .strf extension. Probably easiest thing to do is copy "tiles.strf" and then modify with any text editor. When modifying, you will need to do two things to access your tiles via the editor. First set up the actual mapping, this assigns a unique number to each tile of your image. For example, the large (2x2 tile) basic solid block has the following mapping code:
{l Code}: {l Select All Code}
  (tiles
    (width 2)
    (height 2)
    (ids
      50 49
      51 52
    )
    (attributes
      1 1
      1 1
    )
    (image "tiles/blocks/bigblock.png")
  )

For attributes, 1=solid, and 0=unsolid, you can search the file for examples of other attributes if you need to (for example slopped, unisolid, ice, hurting, etc. some of these will then need an additional designation for data, again if you get this complex you can look at "data/images/tiles.strf" for examples). The image used is your custom artwork and must match the dimensions of width and height (in units of tiles=32 pixels). The ids are unique numerical values that tell SuperTux which tile to use. You must make sure you assign numbers that have not been used yet (see the bottom of the file for the next available number). Currently id values have reached past 3000, if you intend to keep your custom tiles self-contained you can be lazy and just start numbering from an arbitrary high value such as 6000.

After mapping, it is advisable to give the tiles a group so you can find them easily in the editor. For example I can make a group "Big Block" which will show up in the tile group pull-down menu in the editor with the following code:
{l Code}: {l Select All Code}
(tilegroup
    (name "Big Block")
    (tiles
     50 49 0 0
     51 52 0 0
    )
)

The extra zeros are to make the image look pretty in the editor, which makes for easier placement (tiles are displayed in rows of 4 and I didn't want to break up the block). This may make more sense when you are actually setting it up yourself when you can see the results in the editor. Strictly speaking this second bit of code is not necessary, but it makes it a lot easier than scrolling through all available tiles in numerical order.

Once your .strf tile mapping file is all set, you need to select it for the level properties in the editor. This is done the same way as selecting worldmap tiles. If you do this in an already created level, you will need to save and re-open if you want old tiles to be updated.

Note if you want to make custom worldmap tiles- the process is largely the same; however, to get the editor to treat your worldmap tiles as a worldmap, you need to include "world" in the filename. For example: "super_awesome_worldmap_tiles.strf", "stickyworld.strf" or "toads_world.strf"- it doesn't really matter just so long as "world" is part of the string. This also means you do not want the string "world" included in any level tileset you put together, otherwise the editor will treat it like a worldmap and you won't be able to place badguys etc..

I think that about covers it. If I missed some critical detail or you want more info/clarification, feel free to ask.
User avatar
LMH
 
Posts: 105
Joined: 04 Jan 2012, 19:39

Re: How can I use custom tiles in the editor?

Postby Lolkat » 19 Sep 2014, 21:08

Late reply, thanks for the tutorial! :D
I made a custom snowball sprite guy with sprite file but I can't figure out how to use him in the editor. Mr. Bomb has the spritefile path, but none of the others like snowball do.
User avatar
Lolkat
 
Posts: 27
Joined: 23 Jul 2013, 04:42

Re: How can I use custom tiles in the editor?

Postby ctdabomb » 20 Sep 2014, 00:19

Hmm... If I recall correctly, you can't. But the last time I tried that was a while ago and not with the latest editor. There was talk of being able to do this with all badguys, but I don't know if it was implemented or not.
Some people are like slinkies... not really good for anything, but you still can't help smiling when you shove them down the stairs.
ctdabomb
 
Posts: 1075
Joined: 13 Dec 2011, 21:21
Location: halfway there

Re: How can I use custom tiles in the editor?

Postby LMH » 25 Sep 2014, 04:24

You will likely need to update your editor. The recent git version has a greater ability to change sprites- including snowballs.
User avatar
LMH
 
Posts: 105
Joined: 04 Jan 2012, 19:39

Re: How can I use custom tiles in the editor?

Postby Lolkat » 28 Sep 2014, 21:45

LMH {l Wrote}:You will likely need to update your editor. The recent git version has a greater ability to change sprites- including snowballs.

Is the recent editor version windows compatible?
User avatar
Lolkat
 
Posts: 27
Joined: 23 Jul 2013, 04:42

Re: How can I use custom tiles in the editor?

Postby LMH » 29 Sep 2014, 03:55

Lolkat {l Wrote}:Is the recent editor version windows compatible?


Technically yes. However, it is very painful to build from source. I've never done it myself, but I know it is possible. There exists a snapshot windows version of the editor around version 0.3.4 (see this thread for the most recent snapshot to my knowledge), but I cannot recall if it will have the sprite features you want.

If it does not, you will have to edit the level file outside of the editor (using any text editor). Find the badguy you want to use the custom sprite with and change the code following this example:
{l Code}: {l Select All Code}
(snowball
   (sprite "images/custom/custom_badguy.sprite")
   (x 160)
   (y 160)
)

Obviously, you will need to use the correct filepath to your specific custom sprite (starting from the data directory). Finding specific badguys can be a challenge, and you may need to record their specific x-y coordinates from the editor first in order to find them. Once you manually modify the level, you will likely have to test it through SuperTux proper as the editor will likely ignore the change- in fact if you futher modify the level with the editor, you will have to go back and manually set the sprites again since saving in the editor will remove anything the editor cannot recognize. Thus it is best to make manual changes only once your level is complete and running smoothly.
User avatar
LMH
 
Posts: 105
Joined: 04 Jan 2012, 19:39

Who is online

Users browsing this forum: No registered users and 1 guest

cron