Page 1 of 1

Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 13:08
by darkhog
I have few ideas, but it would require me to put custom sounds/graphics in my levelpack. Can I do that and if so how?

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 13:45
by mteufel
Yes, this is possible!

If you're right now only editing it using the level editor: Go to wherever the level editor saves its levels. On Linux, that is usually in `~/.local/share/supertux2/`. The levelsets are usually saved (as folders on their own) in the `levels` subdirectory of that folder. For music, create a `music` subdirectory in `~/.local/share/supertux2/`, for sounds a `sounds` subdirectory, for graphics an `images` subdirectory (for images, it is advisable to follow the subdirectory structure as used in the main game). You should then be able to access those from the level editor.

If you want to create an add-on, you have to include these folders and files as well!

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 13:50
by manuel
Make sure that you are allowed to share those sounds/graphics (e.g. make them yourself or get the creator's permission).

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 15:15
by darkhog
Yeah, I want to share that set later on so I'd need an addon, I think. How would I make one though?

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 15:56
by manuel
Add-ons are packed like this:
[this is a folder]
-this file is in the folder above

<Worldmap ID>.nfo (See below for how this file should look like)
[levels]
-[<worldmapid>]
--levels.stl
--worldmap.stwm
--info-file (See below, just copied it from your other packing question)
[images] (only if you have custom textures)
-[tiles] (for tiles, obviously)
-[creatures] (for sprite files)
-[worldmap] (for worldmap tiles)
-tiles.strf (if you use custom tiles)

Make sure to select youraddon.nfo, [levels] and [images] and zip those three together without creating a folder around them.


<Worldmap ID>.nfo
{l Code}: {l Select All Code}
(supertux-addoninfo
  (id "Worldmap-ID")
  (version 1)
  (type "world")
  (title "Your Worldmap Name")
  (author "Your Name")
  (license "CC-by-sa 4.0")
)

For "Worldmap ID" use only letters, numbers and _ or - , no spaces. You should name it YourName_Worldmap-Name to avoid two identical IDs.
Type should be "world", "worldmap" or "levelset" (if you have no worldmap).
Title: The name of your world, which should be displayed (spaces are allowed)
Author: Your name
License: Keep it as-is to allow sharing and modification of your Worldmap

{l Code}: {l Select All Code}
(supertux-level-subset
(title (_ "Name that should be displayed"))
(description (_ "A short description"))
(levelset #f)
(hide-from-contribs #f)
)

So for title and description just enter a short text between the "".
If your levels don't have a worldmap, change levelset to #t.
If you don't want to see your world in-game, change hide-from-contribs to #t. So, just leave it as-is.

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 16:02
by manuel
Here's a screenshot for an example add-on.

Re: Can I use custom sounds/graphics in my level?

PostPosted: 15 Feb 2018, 18:50
by mteufel
manuel, you'd do everyone in the community a great favor (I think) if you contributed this stuff to the wiki (https://github.com/SuperTux/wiki). Feel free to get back to me if you need assistance.