Demon Island: Cursed Knife


the Demon Island game engine is designed to be flexible and easy to play with. i added this new item to demonstrate some weapon properties and to test syncing those properties applied to entities over the network

the cursed knife has a very fast attack rate, allowing you to go absolutely nuts on some unsuspecting slimes. like many other things, its properties are defined in JSON like this:

"cursed knife": {
  "description": "This knife seems cursed!",
  "tags": ["weapon"],
  "max stack": 1,
  "properties": {
    "equippable": {
      "slots": ["hands"],
      "effects": {
        "atkDamage":
          { "value": 2, "stack": "replace" },
        "atkLength":
          { "value": 1.00, "stack": "replace" },
        "atkCooldown":
          { "value": 0.075, "stack": "replace" },
        "atkDuration":
          { "value": 0.075, "stack": "replace" },
        "knockback":
          { "value": 0.25, "stack": "replace" }
      }
    }
  }
}

the really fun part is properties, which are essentially behaviors. the cursed knife has just one, the equippable property. slots tells us which types of slots the item can be equipped in, for this item its held, which means we can put it in our hotbar and equip it that way. other possible values are head, chest, hands, etc.

effects contains all the properties of the entity we want to modify, by how much, and in what way. this is a very flexible way to define item effects, because we can modify any entity property in whichever way we want. so, as we are making a weapon, we just set the attack properties of the entity that has equipped this item. most are obvious, but a couple are interesting enough to explain. atkLength defines the length of the hitbox that gets generated when attacking:

the size we are using is quite small, because its a knife. there’s also atkDuration, which is the actual amount of time the attack hitbox sticks around, damaging monsters it intersects with.

there’s not a whole lot of properties to modify right now, but i plan on adding a lot more, including things such as armor/clothing sprite layers, movement properties, defense, attack combo/charge properties, etc. all of which will be modifiable through item equips, and eventually, status effects as well.

stay tuned for more!

Leave a comment

Log in with itch.io to leave a comment.