Projectiles are also Objects and need to be created separately in order to be used by Monsters.
As we have seen in the Tutorial section, when we added our projectile to the monster we referred to the Yellow Star projectile by its ObjectId and defined how that projectile must behave for that specific monster. That means that the same projectile can be shot by different monster and have different properties!
Let's have a look at the example of creating a projectile as shown below:
The Yellow Star Projectile Example
<Object type="0x0000" id="Yellow Star">
Yellow Star Sprite
Here is what each of the fields mean:
<Object type="0x001a" id="Yellow Star">
This creates the concept of an object. The “type” and “id” fields must be unique. For projectiles, type must be less than 0xFF. For testing purposes, use the 0x005X space for projectile types and use whatever ids you want (although, again, they need to be unique).
This is a boilerplate used internally, always include it.
This is the texture to use for the projectile.
This will cause the projectile to rotate as it moves. The default (0) is no rotation.
If the texture points toward the upper right hand corner (45°) instead of to the right (0°), include this line to ensure that the projectile is correctly rendered.