The Projectiles dictionary in the Root of the property list stores info for every projectile, whether it’s meant for the player or an enemy. This way you can share projectile data between versions of the player or multiple enemies. So instead of having to re-define the same Sword data in every enemy, you can simply reference the a name in the Projectiles dictionary.
Lets take a look at the properties for projectiles…
- Image – this is the base image for the projectile being thrown. Even if you replace it with an animation, this base image should be setup to size the projectile being thrown.
- Icon – this is the name of the image that will act as icon in the GUI when the player is using this projectile. It will show up wherever the ProjectileIcon sprite is located in the GUI.sks. In the Demo version of the kit, this is in the bottom left of the GUI. When the player taps this icon, they can switch between projectile weapons they currently have in inventory (and have ammo for). This property is ignored if the projectile is being thrown by an enemy.
- Ammo – this is a Number value for the amount of ammo the player would start with when receiving this projectile as a reward. The amount of ammo appears in the GUI via the AmmoLabel SKLabelNode.
- Animation – this is the name of a saved action in the Actions.sks file (or any .sks file) which can animate the textures of the projectile thrown, or it could also add some kind of extra movement (a wobble maybe), fade, or scaling effect. Saved actions can be a combination of multiple actions. So really anything is possible. If you leave this value blank it is ignored. It can also be deleted too if it won’t be used.
- ContactAnimation – this is the name of a saved action in the Actions.sks file (or any .sks file) which will play when the projectile contacts something and is removed.
- TravelTime – this is a number value for how long the projectile is moved for. So the higher the number, the slower it will be seen moving across the screen.
- Distance – this is a number value for how far the projectile goes. If you leave this blank, the projectile should go far enough to leave the screen.
- RotationTime – this is a number value for how fast the projectile rotates, or does one full rotation. Delete this property if you don’t want the projectile to rotate.
- Damage – a non-decimal number value for how much damage the projectile inflicts on either the player or enemy.
- Remove – a Bool value for whether or not the projectile is removed from the scene after it is thrown.
- ZPosition – a Number value for the z position the projectile appears at. The higher the number, the higher it will visually appear in the scene. By default, the player’s z position is at 0.
- Offset – this number value will offset where the projectile is initially seen from the thing throwing it. Usually you want some offset value or else the projectile looks a bit funny coming directly from the middle of the thrower.
- ImpactWithItems – a Bool value, YES means the projectile will be removed when it collides with an Item (anything with the WorldItem custom class). Setting NO, would mean the projectile would usually push it’s way around an item it comes in contact with.
- Sound – the sound the projectile makes when it is thrown. The value you here would be the full file name, including the file extension (.caf / .mp3)
- ImpactSound – the sound the projectile makes when it impacts something. The value you here would be the full file name, including the file extension (.caf / .mp3)