-
Notifications
You must be signed in to change notification settings - Fork 87
XML\Animation
The XML element contains the animation data (frames, movements and directives).
You need at least one animation element. This element describe how the pet should move around the screen and what should happens if the pet detects a collision or has ended the animation. At the end, it gives the next animation that should be executed.
An animation is started after a spawn or after another animation was finished.
Example:
<animation id="1">
<name>walk</name>
<start>
<x>-4</x>
<y>0</y>
<interval>150</interval>
</start>
<end>
<x>-4</x>
<y>0</y>
<interval>150</interval>
</end>
<sequence repeat="20" repeatfrom="0">
<frame>2</frame>
<frame>3</frame>
<next probability="10" onlytaskbar="true">7</next>
<next probability="90">1</next>
</sequence>
<border>
<next probability="100">2</next>
</border>
<gravity>
<next probability="100">5</next>
</gravity>
</animation>
Is the child of the root of the XML document.
Type: Number
Beginning with 1, you can add more animation elements (each with another ID - incremented by 1).
This ID is used to identify an animation. This value is represented in the "next" element.
Max occurs: 1
Type: String
Name of the animation. This is used only for debug purposes to see what kind of animation was executed.
those animation-strings are predefined:
string | description |
---|---|
fall |
if you use this name on your animation, the pet will use automatically this animation if a gravity-loss is detected. |
drag |
if you use this name on your animation, the pet will use automatically this animation if you pick it up with the mouse. |
kill |
if you use this name on your animation, the pet will use a last animation (not more than 1 second) before it will be closed. |
sync |
if you use this name on your animation, all pets will be synchronized when the user press "Ignore" on the about box. |
Max occurs: 1
Type: Element
Start values for the animation: frame move values. This element has always 3 childrens:
Max occurs: 1
Type: String
Single frame move in the X-axis (horizontal movement for each step). 0 means it doesn't move on this axis. Open defined strings for coordinates if you want insert dynamic values.
Max occurs: 1
Type: String
Single frame move in the Y-axis (vertical movement for each step). 0 means it doesn't move on this axis. Open defined strings for coordinates if you want insert dynamic values.
Max occurs: 1
Type: String
Time between frame moves (timeout to next step). Don't be too fast... Don't use 100% of the CPU for this application! Select a value of at least 50, best value is from 100 to 150. Open defined strings for coordinates if you want insert dynamic values.
Max occurs: 1
Type: Element
End values for the animation: frame move values. This element has the same children as the <start> element. If you set a start value of 5
and an end value of 10
, it means that the entire sequence described in this animation is stepped up from 5 to 10. The first frame will move right 5px at beginnings and 10px with the last move.
Max occurs: 1
Type: Element
The sequence of the animation. Let see this sample:
It is a 2x2 image frames and images are indexed as fallows: 0 (upper left), 1 (upper right), 2 (bottom left), 3 (bottom right) - from top left to bottom right.
So if you want a walking sheep, you have to use only 2 frames: frame 0 and frame 1. What you can do is to add 100 frames (0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,...) but this is not a nice solution. The best way is to add only 2 frames: 0 and 1, and repeat them 50 times. After the sequence of animation is over another animation will be executed.
This element has 2 attributes and a lot of childs:
Type: String
How many times the frames should be repeated. 0 means it doesn't repeat. Open defined strings for coordinates if you want insert dynamic values.
Type: Number
If you have a lot of frames, you can choose to repeat only a part of them (initial movement + loop for example). Leave this value to 0, if you don't want repeat from any frame but you want repeat all frames.
Max occurs: ∞
Type: Number
Index of the frame on your image. Every frame is played at least 1 time. At the end, if repeat is 0, the next animation is loaded. If, for example, repeat is 5, all frames are played 5 times. With 2 frames it means 10 frames. The interval from start and end element, represent the initial value and end value of all 10 frames, not only a single sequence.
Max occurs: 100
Type: Element
This element is complex and used also on other elements (border, gravity), so refer to this page to know more about it: next element. The Next element give the next possible animation. If the next element is not present, the pet will disappear from the screen and a new pet will be "created" using the spawn element.
Max occurs: 1
Type: Element
All images on your animation have only 1 direction (left to right or right to left). If your pet arrive to the other side of the screen, you can for example flip all images, so you don't need to draw every frame twice. The action element can have one of the fallowing values:
string description flip
flip all images (moving from left to right, for example). Also the x values of each animation will be flipped so, that a value of 5 become -5.
Max occurs: 1
Type: Element
If set, windows and screen borders will be detected. Currently only the top of the windows are detected. Maybe in future also the side borders and bottom border of each window will be detected (version 2?).
Detected borders:
If the image is moving to a border: left, right, top, taskbar or window (not bottom and not side borders of window), one of the animation described in next elements of this border-element is executed.
This element has only a type of children:
Max occurs: 100
Type: Element
This element is complex and used also on other elements (sequence, gravity), so refer to this page to know more about it: next element. The next-element give the next possible animation. If the next element is not present, the pet will disappear from the screen and a new pet will be "created" using the spawn element.
Max occurs: 1
Type: Element
If set and the pet is currently on a window, (only) the window border is continuously detected. If the window is covered by another one or if you move up/down the window, the pet will be animated with another animation, described in the next-element.
Detected borders:
This element has only a type of children:
Max occurs: 100
Type: Element
This element is complex and used also on other elements (sequence, border), so refer to this page to know more about it: next element. The next-element give the next possible animation. If the next element is not present, the pet will disappear from the screen and a new pet will be "created" using the spawn element.