Post by BonzaiRob on Jan 6, 2008 14:31:07 GMT
Tutorials you will need:
[X]Maps!
Always download and use the latest demo before continuing!
NOTE: This tutorial WILL be altered as the engine progresses; water is still not coded properly, nor are ledges or houses.
If you've done the basic Map tutorial, and have looked around at the ther maps' code, you might well have noticed some tags not covered in that tutorial. Here, I will explain a few of them.
Example 1: Actiontile
Isn't it an exciting name? Action! What it actually means is a tile that interacts with teh player in some way. There are only a few types right now: WildGrass, Footprint, WarpTile, Signpost. We can safely ignore Signpost because it doesn't work just yet.
First, here we have a very very basic Actiontile tag, with elements common to all or most of them.
Class is the type - WildGrass, Footprint, etc. X and y have been covered before.
BaseImage is the basic image used when there's nothing going on with the tile. If you don't want that, there's an image in tiles called invis.png, which is very useful
The other two are the interesting ones. They control the images or animations that happen when the tile is activated. First they can be images or animations; second , they can happen Coming, On, Over or Leaving, and third, Over or Under the player. This we can mix them up! imageComingOver, animLeavingUnder, any mix you like.
Images are just tile-sized (16x16), but Animations must be split into tiles. If you go into data/Pokemon Treasures/images/animations/, you will see the images we use for wildgrass and footprints. We tell it what do do witht eh aniamtions like this:
It seems a bit big at first, but WildgrassComingOverAnim.png is just the image. The rest , split by colons ( is what handles the animation.
First there are the columns and rows that the animation image is split into. 4,1 means 4 tiles across (the 1 is just one tile down). They're split by a comma.
Next is that 250. That's the delay in milliseconds between each frame. There are 1000 milliseconds in a second, so 50 is a quarter. The animation altogether takes 1 second (4 frames x 250 ms = 1000).
Finally, the 'false'. that's whetehr the animation loops or not. Most of the time, I would imagine it to be false, but you can change it to true if you want to mess around. Which I wholeheartedly condone
And that's all you need to know for a standard WildGrass tag, like so:
Next I'll talk about Footprint. It's much the same, but unfortunately not actually supported in the latest demo XD That will be in the next one. Here's what it looks like, anyway:
Much the same as WildGrass instead of the animation controls, we have just framesDelay. Columns and rows, then the delay between frames. What direction they face is controlled by the engine. They don't need to loop.
Finally, we have WarpTile.
baseImage, x and y are the same as ever. This is an easier one to explain though: destMap is the map you want to warp to, destX and destY are the coordinates where you want to land.
However, notice the X is -1 in the example? There's a slight problem right now, which means that the player ends up down and right 1 tile from the coordinates specified XD We'll fix that next demo.
Example 2: fillActionTile, area
This is a great timesaving feature, because we're awesome. See also Example 3.
What this means is, instead of specifying a row of 10 tiles or actiontiles, you can do one of these fill and make it 10 wide.
Note that the image is specified with tiles/image. You can put objects here too if you really want to (though they'll be under the player).
Example 3: fillObject, objectset, fillPattern
A little more complicated this time.
fillObject
Like objects, yous specify a rect as well as x and y. Like fill, you set a width or height, but unlike tiles, you need to set a repeatx or repeaty - this si teh distance between each repeat. Like above, the y is two - the top tile of each tree, plus a tile under it. The next tile under is the start of the next tree. Experiment with it and you'll get the hang of it.
objectset
What objectset does is let you put objects into groups based on their x and y. For instance, you can make a group of trees and move the whole lot by the set's coordinates.
fillPattern
This is a lot like objectset, except it has the repeatx and repeaty, and width and height of fillObject. If you have a pattern of trees, you need only code one group and tell it to repeat!
And that's the more advanced features! This tutorial will get updated as more features are added; look out for water and houses, and properly coded ledges.
[X]Maps!
Always download and use the latest demo before continuing!
NOTE: This tutorial WILL be altered as the engine progresses; water is still not coded properly, nor are ledges or houses.
If you've done the basic Map tutorial, and have looked around at the ther maps' code, you might well have noticed some tags not covered in that tutorial. Here, I will explain a few of them.
Example 1: Actiontile
Isn't it an exciting name? Action! What it actually means is a tile that interacts with teh player in some way. There are only a few types right now: WildGrass, Footprint, WarpTile, Signpost. We can safely ignore Signpost because it doesn't work just yet.
First, here we have a very very basic Actiontile tag, with elements common to all or most of them.
<actiontile class="" x="" y="" baseImage="" imageOnUnder="" animOnOver="" />
Class is the type - WildGrass, Footprint, etc. X and y have been covered before.
BaseImage is the basic image used when there's nothing going on with the tile. If you don't want that, there's an image in tiles called invis.png, which is very useful
The other two are the interesting ones. They control the images or animations that happen when the tile is activated. First they can be images or animations; second , they can happen Coming, On, Over or Leaving, and third, Over or Under the player. This we can mix them up! imageComingOver, animLeavingUnder, any mix you like.
Images are just tile-sized (16x16), but Animations must be split into tiles. If you go into data/Pokemon Treasures/images/animations/, you will see the images we use for wildgrass and footprints. We tell it what do do witht eh aniamtions like this:
animComingOver="WildgrassComingOverAnim.png:4,1:250:false"
It seems a bit big at first, but WildgrassComingOverAnim.png is just the image. The rest , split by colons ( is what handles the animation.
First there are the columns and rows that the animation image is split into. 4,1 means 4 tiles across (the 1 is just one tile down). They're split by a comma.
Next is that 250. That's the delay in milliseconds between each frame. There are 1000 milliseconds in a second, so 50 is a quarter. The animation altogether takes 1 second (4 frames x 250 ms = 1000).
Finally, the 'false'. that's whetehr the animation loops or not. Most of the time, I would imagine it to be false, but you can change it to true if you want to mess around. Which I wholeheartedly condone
And that's all you need to know for a standard WildGrass tag, like so:
<actiontile class="WildGrass" baseImage="wildgrass1.png" animComingOver="WildgrassComingOverAnim.png:4,1:250:false" imageOnOver="wildgrass1OnOver.png" imageComingUnder="wildgrass1OnUnder.png"
x="15" y="3" />
Next I'll talk about Footprint. It's much the same, but unfortunately not actually supported in the latest demo XD That will be in the next one. Here's what it looks like, anyway:
<actiontile class="Footprint" baseImage="sand1.png" framesDelay="4,1:250"
x="16" y="11" />
Much the same as WildGrass instead of the animation controls, we have just framesDelay. Columns and rows, then the delay between frames. What direction they face is controlled by the engine. They don't need to loop.
Finally, we have WarpTile.
<actiontile class="WarpTile" baseImage="rock2.png" x="46" y="27" destMap="route58.map" destX="-1" destY="11"/>
baseImage, x and y are the same as ever. This is an easier one to explain though: destMap is the map you want to warp to, destX and destY are the coordinates where you want to land.
However, notice the X is -1 in the example? There's a slight problem right now, which means that the player ends up down and right 1 tile from the coordinates specified XD We'll fix that next demo.
Example 2: fillActionTile, area
This is a great timesaving feature, because we're awesome. See also Example 3.
What this means is, instead of specifying a row of 10 tiles or actiontiles, you can do one of these fill and make it 10 wide.
<area fill="tiles/sand1-bottom.png" x="3" y="16" width="21"/>
<fillActiontile class="Footprint" baseImage="sand1.png" framesDelay="4,1:250"
x="16" y="11" width="8" height="3" />
Note that the image is specified with tiles/image. You can put objects here too if you really want to (though they'll be under the player).
Example 3: fillObject, objectset, fillPattern
A little more complicated this time.
fillObject
<fillObject image="peach-spring.png" x="0" y="-1" recty="1" rectheight="2" repeaty="2" height="14" />
Like objects, yous specify a rect as well as x and y. Like fill, you set a width or height, but unlike tiles, you need to set a repeatx or repeaty - this si teh distance between each repeat. Like above, the y is two - the top tile of each tree, plus a tile under it. The next tile under is the start of the next tree. Experiment with it and you'll get the hang of it.
objectset
<objectset x="6" y="8">
<object image="ledge1-botleftendx.gif" x="0" y="0" />
<object image="ledge1-bottom.gif" x="1" y="0" />
<object image="ledge1-bottom.gif" x="2" y="0" />
<object image="ledge1-botrightendx.gif" x="3" y="0" />
</objectset>
What objectset does is let you put objects into groups based on their x and y. For instance, you can make a group of trees and move the whole lot by the set's coordinates.
fillPattern
<fillPattern x="-3" y="29" repeatx="4" repeaty="4" repeatwidth="4" repeatheight="1">
<object image="peach-spring.png" x="0" y="0" recty="1" rectheight="2" />
<object image="peach-spring.png" x="2" y="0" recty="1" rectheight="2" />
<object image="peach-spring.png" x="1" y="2" recty="1" rectheight="2" />
<object image="peach-spring.png" x="3" y="2" recty="1" rectheight="2" />
</fillPattern>
This is a lot like objectset, except it has the repeatx and repeaty, and width and height of fillObject. If you have a pattern of trees, you need only code one group and tell it to repeat!
And that's the more advanced features! This tutorial will get updated as more features are added; look out for water and houses, and properly coded ledges.