HowToUseTiledToCreateStendhalMaps2: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Kymara
imported>Kymara
Animations: updated
Line 82: Line 82:


=Animations=
=Animations=
Most tiles we use in stendhal now which should be animated, are animated already. For example the white daisy, the flames, etc. We document here how it's done.<br>
{{AddMissing|towhat = section |toadd = the newer method, used since the tileset porting,}}
Ok, map is done, ready to comitt... but there is still one more thing we need to do to have some movement in the world... Animations.<br>
<br>
<br>
The animations are configured in a file at tiled/tileset/animation.seq. Lets look at a simple example, the flames. T
Animations is a bit troblesome to do right now. If you look in the bottom of the src\games\stendhal\client\TileRenderer.java file you have a rather long list, this is a list of tiles that should be animated, and what order it should be animated in. Im gona take the Double white daisy as example (the white flower having two flowers on one tile)
<pre>
tileset/item/furniture/light/flames.png 0 0:1
// Double white daisy
tileset/item/furniture/light/flames.png 1 0:1
addAnimatedTile(22,new int[]{22,52,82,112,112,112,112,112,112,112});
</pre>
addAnimatedTile(52,new int[]{52,82,112,22,22,22,22,22,22,22});
The flames.png has two tiles, counting from 0 they are numbered 0, 1. There is an entry for each tile which should be animated. 0:1 tells the order they should animate in.
addAnimatedTile(82,new int[]{82,112,22,52,52,52,52,52,52,52});
addAnimatedTile(112,new int[]{112,22,52,82,82,82,82,82,82,82});


Lets try a more complicated example, the white daisy. That is a file with both a double daisy and a single daisy in it. We want the double daisies animated in a sequence, and the single in a sequence, and never the twain shall meet.
Now the double daisy has 4 animation tiles in the outside_0 tileset, what we do is count to these tile positions from the start in the tileset to the tile we want, starting in the upper left corner, going towards right, then jump to the next row in the tileset, until we encounter the tile we want (math is a good friend here....) then we write that tileid down at the first place (outside the {} parantheses). This will tell that this tile will have an animation, that goes in the order described inside the {} parantheses. Repeat this process for all the tiles you want animated, and they will be animated ingame later when server resets. If the lines for the tiles you want animated already exist, you don't need to bother about animations thou, cause those tiles will already be animated.<br>
<br>
<pre>
tileset/plant/flower/daisy_white.png 0 0:2:4:6@3500
tileset/plant/flower/daisy_white.png 2 2:4:6:0@3500
tileset/plant/flower/daisy_white.png 4 4:6:0:2@3500
tileset/plant/flower/daisy_white.png 6 6:0:2:4@3500
tileset/plant/flower/daisy_white.png 1 1:3:5:7@3500
tileset/plant/flower/daisy_white.png 3 3:5:7:1@3500
tileset/plant/flower/daisy_white.png 5 5:7:1:3@3500
tileset/plant/flower/daisy_white.png 7 7:1:3:5@3500
</pre>
The even numbers tiles, 0:2:4:6, are the double daisy. So for example tile 0 in daisy_white.png animates 0->2->4->6, through all the 'double daisies' in sequence. Same for the other double tiles.
The odd numbers tiles, 1:3:5:7, are the single daisy. As you've probably now guessed, tile 1 is told to animate through 1:3:5:7, all the single daisy frames.


In the white daisy example, notice the extra @3500 after the sequence order. This tells the (somewhat slow) speed that daisies are animated at. If you don't want to use the default speed, try adding a speed like this and do 'trial and error' till you achieve a realistic effect.
If you have any unanswered questions after this, please join our IRC channel irc.freenode.net #arianne, and I will answer them with the best of my abileties.


If you have any unanswered questions after this, please join our IRC channel irc.freenode.net #arianne, and we will answer them with the best of our abilities. Just ask and wait around for someone to answer :)
Anders Asplund aka [[User:Danter | Danter]] @ irc.freenode.net #arianne


----
----