Need help with my inventory project


#1

i can get the first box to be filled but not the 2nd or 3rd?
im not getting any syntax errors either and i can pickup all three objets but only 1 shows up in the 3 slots

inventory project.wick (11.0 KB)


#2

Hey!
Basically what was happening is you forgot to check if slot2isfull for the

else if

Here’s the updated code for the ball:

function mousePressed() {
if (slot1isfull === false) {
slot1.gotoAndStop(2);
slot1isfull = true; // Slot 1 is now being used
this.delete();
} else if (slot1isfull === true && slot2isfull === false) {
slot2.gotoAndStop(2);
slot2isfull = true;
this.delete();
} else {
slot3.gotoAndStop(2);
slot3isfull = true;
this.delete();
}
}

You can check this early build for a game that I’m making in Wick, it has an inventory system:
Flashy Ops-Dec29-2018-10.49AM.wick (22.7 KB)


#3

Hey can You help me with savedata and loaddata?


#4

@Animator786 Yes, as soon as I can figure out how to use it :laughing:. Whenever I try to use loadData() it returns an error. I’ll get back to you if I can help.


#5

okay thanks


#6

@Animator786 Alright I’ve figured it out.
Here’s an example where the user’s level and score is saved:

To save, I used JavaScript’s localStorage methods.
To create a new save:

localStorage.setItem(‘name’, value);

You can also used setItem to edit the value.

Save Data Example-Jan6-2019-3.06PM.wick (688.6 KB)

You can look inside of the project to see how it works. If you need anymore help, feel free to ask me.