Ask coding questions

← Back to all posts
Inventory and collect system in html javascript and css
ichbindede

I'm making a simple game in html javascript and css. And I need an inventory system. Like when you pass 5th and 10th level I will give the players 5 golds, free level pass item and a medal. So I need a working inventory system and people can collect items and use the items (like level pass item). But I don't know how to do so can anyone help?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
ichbindede
Comments
hotnewtop
Coder100

You can use an object to store data:

ichbindede

ok thanks @Coder100

Coder100

np
mark as correct answer? @ichbindede

ichbindede

wait, what should i write to the (...); ? @Coder100

Coder100

anything you want to represent an item, I would do a class, but you could also do an object: { type: "level-pass" } or smth @ichbindede

ichbindede