How do you make an item in the store change when you press a key?

Hello everyone.
Please help me, I'm making a game to surprise my brother, I want to make a game in which you need to update the store and wait until you come across some expensive or not so expensive thing to buy it, and then sell it + there will be a chance to double its value and sell the item 2 times more expensive. At the moment, help me make sure that when the button is pressed, the item changes along with the cost in the store (each item has a separate cost)
Please <3

How do I make sure that when the button is clicked, the product changes instead of the value in the store

Hello,

Please show us the relevant blocks of what you have developed so far and explain in detail what problem you have encountered.

image
Thank you so much for such a quick response!
That's all I've done so far. I would like to make it so that instead of just pictures appearing to these pictures, the amount of this item appears, and that this item can be successfully purchased. If you don't understand me well, I'm sorry, I don't know English well, I'm writing to you through a translator.

If you want several characteristics associated to the same item you can use a list of list.

Wow, thank you so much for helping so much. Let me ask how it is possible to make it so that for this specified cost, as I understand it, it is under image 1,2,3,4. So that for this cost it would be possible to purchase this item and preferably that it would be stored in the inventory. I'm just a complete noob at mit app inventor)

I'm not really sure what are you requesting. Anyway, if you want, together the image and the cost, more characteristics (items in inventory) you can add them to the list if lists and access them in the same way than for the elements 1 and 2 of each item.

Then, when a user buy an item, you will have to subtract -1 to the inventory number of that item. Other thing to be considered is where are you going to store that data if you want it to be consistent when you close and reopen the application. For this it could be a good option tinyDB.

Take a look here:
App Inventor 2 Book: Create Your Own Android Apps

And in the community you will find some topics similar to yours.

I have a problem when I click on the Reroll button, it shows me the cost from below, but it does not show the picture itself, it only shows the name of this picture

My example was only a example. To display an image, you need to upload it to your media (assets) and display it in an image.Picture...like in your first blocks. You can copy from my example how to get the elements...but set the jpg into an image component.

To which media/resources? I don't understand you very well, maybe it's because I'm 0 in mit app inventor)

The same but the first element of the item (image) is displayed on an Image component.

And this jpgs...
image

I suppose you have them uploaded into your app:
image

I finally understand what you're talking about! I did everything and it worked out for me) Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.