Reference:FIFE:Minimal:Adding a Character to the Map

(Note: this article follows on from the earlier turtorials, part 1: Minimal Fife engine: An introduction and part 2: Loading a map and scrolling it around, and is highly recommended that you read those articles first)

The next stage is to add a character to the map that we can control. Once again, we will first have to grab some graphics from the Rio demo, so firstly create this folder structure:

/fife/clients/pdemo/objects/agents/girl

And then copy everything from

/fife/clients/rio_de_hola/objects/agents/girl

into it. We now have all the graphics we need. Our next step is simply to put her into the map, firstly as just another part of the map. We can do this by merely editing the map details, we don't need to touch our code. So grab your trusty text editor and load up map.xml. At the top after the import file line the base sand object, add the following:



Now a bigger addition, scroll down to near the end, after all the sand definitions to find  . We are going to insert a new layer, this time not for the ground but for objects on the ground. Normally I'd use the map editor, but it doesn't seem very user-friendly for this sort of thing. Anyway, insert this XML between the   and the  

Now run the code again and this time you should see the map with our sprite going through a simple animation at the centre.

To be continued...