The types of items

I would like to know the types of items there is in the game and I need an if statement like

if item.type == coin:

Can some one help?

Well here’s the list of collectable $ earning items.
1 is if item.type=='gold-coin':Code for checking if it is a gold coin.
2 is if item.type=='silver-coin':Code for checking if it is a silver coin.
3 is if item.type=='bronze-coin':Code for checking if it is a bronze coin.
4 is if item.type=='chest':Code for checking if it is a chest.
5 is if item.type == "gem":Code for checking if it is a gem.

3 Likes

And if item.type == "gem":

1 Like

I need one for the healing potion

if item.type=='potion':
3 Likes

Thank you! This will help a lot

What about for an area/trial? I’m working on The Trials and after defeating all enemies in one area and collecting the mushrooms how do I move to the next area? I know the names of the areas but how do I get the pos of these areas to pass into my function?

function findNextTrial() {
    let areas = ["Oasis of Marr", "Oasis of Anele", "Temple of Mirth", " Monument to the Old Gods"];
    
    return;
    //move to next area
    //Oasis of Marr, Oasis of Anele, Temple of Mirth, Monument to the Old Gods
}
1 Like

May be try to create dictionary of the positions of each area with the names as the keys and the positions as values in a dictionary, i.e.:

let areas = {"Oasis of Marr": {"x": X, "y": Y}, "Oasis of Anele": {"x": X, "y": Y}, "Temple of Mirth": {"x": X, "y": Y}, "Monument to the Old Gods": {"x": X, "y": Y}}

And then you can call each value out. A simpler, more easier way is to store each position as its own variable and move to that.

2 Likes

Thanks @FalconX11_312 I thought about doing it this way but thought there might be a simpler way of targeting each area. I’ll do it this way though.

1 Like