Thursday Discount - Lifetime Access for $20!!!! - Click Here!

Class Properties

Learn how to define various versions of the main player

The Class dictionary in the Root of the property list is where you’ll setup your player’s initial class and any upgradable classes the player might attain over time. Classes define almost everything about the player. The initial starting class for the player in the demo version of the kit is named Peasant (this can be changed in the Settings of the kit).

Classes can be rewarded to the player by finding items, killing enemies, or gaining XP. Or class changes could occur during specific levels. For example, if you have a water-themed level, the player could automatically be changed to a class with a snorkel outfit. You would do this using the Rewards dictionary for the level (info on that is here)

So let’s unfold the Peasant dictionary, and take a look at the sub-dictionaries within…


As you can see, changing the player’s Class would really change a lot of potential properties about the player. Let’s go through each of these dictionaries.

The Animation Dictionary

The Animation dictionary will define all the saved actions (which will be animation sequences) for the player when they are doing certain things. Take a look…

You can see there is a Back, Front, Right and Left dictionary, and each can optionally contain the same sub-dictionaries Walk, Melee, Ranged, Hurt, Idle, Dying.

If you were to open the Actions.sks file in the kit, you could search for any of the values above and find their saved action. For example, finding the “BackAttack” action would look like this…

The Sounds Dictionary

The Sounds dictionary defines the sounds your player makes. Keep in mind, there’s plenty of other ways to play audio that could seem like it’s coming from the player. For example, if the player opens a treasure chest item, that Item’s dictionary could play whatever audio you want, which could be something said in the player’s voice. Any of the kit’s Rewards dictionaries can play sound, so there’s no shortage of triggers to play audio.

For all the properties in the Sounds dictionary their values should be the entire filename for the audio, include the file extension. Apple recommends .caf for playing short audio clips, but you can use mp3 as well.

  • Melee – the audio to play when the player does a melee attack.
  • Ranged – the audio to play when the player does a ranged (projectile thrown) attack
  • Hurt – the audio to play when the player is hurt
  • Dead – the audio to play when the player is dead

The Melee Dictionary

The Melee dictionary sets up the player’s close combat attack, which is triggered when the user pushes a particular button in the GUI ( the one labeled “B” in the demo). What this does is create a new sprite node that exists for a short amount of time, in a circular, expanding area around the player. How big this area makes it easier for the player to attack things around it. As this “melee sprite” expands outward from the player, the kit detects collisions with it and enemies. The melee sprite is removed after a short amount of time (which you’ll set).

This melee sprite can also have an animation sequence, for example a weapon-like swooshing effect, or explosion.

So if you combine this melee sprite, with the player’s animation sequence for a melee attack, you get a combination like the one seen in the image above.

Let’s take a look at these properties…

  • Damage – a number value for how much damage the melee attack does
  • Image – you can choose a base image for the sprite, which would be seen if the Animation property was excluded. If you set this Image and include an Animation,  this Image property would get replaced right away by the animated frames, and this image really just be used to set an initial size for the sprite. Which is fine, but you can also set a property for the size. You don’t need to set the size property if you include this image.
  • Size – a string value which sets the size of the melee sprite in {width, height } format. For example, {100, 100} . This property is ignored if you include the Image property, as that will set the size.
  • ScaleTo – A Number value for what size the melee sprite will scale to before being removed. The higher this number, the more range your melee attack has.
  • Animation – the name of a save action in the Actions.sks or other sks file, which sets the animated textures for the sprite.
  • TimeBetweenUse – a Number value for the amount of time the player has to wait before doing the melee attack again. The kit has this set to 0, so the player can melee attack as much as they want.
  • Duration – a Number value for how long the melee sprite stays in the scene scaling upward. So 1 would be 1 second. Most likely you want small numbers here. Note the animation duration is determined by the saved action (not this duration).
  • OverPlayer – a Bool value, if YES the melee sprite will visually appear over top the player.


The Ranged Dictionary

If you want your player to throw projectiles, you’ll use the Ranged dictionary to set just a couple properties. Take a look…

  • Projectile – this value will match the name of a dictionary in the Projectiles dictionary. So all the info about the projectile is stored there, not in the player class. This is so you can share projectile data between classes or even between enemies and the player.
  • TimeBetweenUse – a Number value for how often the player can throw a projectile. For example, setting this to 0.5 would mean the player would wait half a second between throwing projectiles. By default this is 0.

The Stats Dictionary

Finally we’ve got the Stats dictionary for basic settings. Take a look…

  • PathSpeed – this number value only applies if the mode of walking is in path mode, where the user draws a line where they want the player to move to. This number would specify how fast the player moves on that path. Most likely, this setting will be ignore as you’ll probably use the default mode (virtual joystick) for controlling the character.
  • Speed – this number value determines how fast the player walks in virtual joystick mode. The higher the number, the faster they walk.
  • Health – a number value for the player’s max health. Note when damaged, the player’s armor is depleted first, then the player’s health.
  • Armor – a number value for the players max armor.  Set this to 0 if you don’t want the player to use armor
  • Immunity – a number value for how long the player is immune to attacks after being damaged

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!