Skip to content

creating item and inventory management

jackdarker edited this page Apr 3, 2021 · 1 revision

Most simple approach

The most basic approach is to have a player-object and add some properties on initGame. //in initGame if (!window.story.state.player||forceReset) { // storage of variables that doesnt fit player window.story.state.player = { health: 100, hasSword:0, //if the property equals 0 player has no sword hasPainkillers:0 //the property } }

using an array

using OOP

Clone this wiki locally