Starlightkitty7 wrote:Hey everyone! I'm really making this game more and more complicated. ^_^' It's fun anyways but once again I'm stuck.
I've already created menu's where you can choose items and such. But how would I create a "Shop menu?" I made it and I added items and dialog. But how would I assign prices to them? Add a price system in the game?
Also, going along with that I should add I don't have a inventory menu yet. But I want that once you buy an item the user can select it in their inventory and a pic or the costume or item is displayed (but that would be a drawn image file.)
Well here is my menu (very simplified)for example that works great so far:
Code: Select all
label store_menu:
"Mage Gown":
s "I love this outfit"
jump con_2
"Warrior Suit":
s "This is more of my style!"
jump con_1
label con_1:
c "Do you like it?"
s "Yeah I think I may get it!"
Help please?
Also! I want to say thank you to those who helped me out in my previous topics. The coding are working wonderful and I appreciate all the help greatly!
Any more than a handful of items and I'd consider looking at a bit of Python to make use of lists and dictionaries to eliminate a bunch of repetitive boiler plate you are going to run into with a lot of items.
Also the
menu statement doesn't cope with changing options. For that you'll want to use look up how to use the ui functions. The ui gives you more freedom too, such as letting you reuse the code so you could have more than one "shop" with different inventories.
A price system would involve a currency
and then a shop's code testing the price of an item against the player's money to make sure he or she has enough of it using
if. To avoid awkward repetitive dialog you'd be best to
def a python function for handling a shop. The way I'd most likely do it is with a dictionary defined to be the "master list" which would have the names of items as keys and the prices as values
Code: Select all
init:
items={
"apple" : 5,
"ring" : 150
}
You could then use lists for the player's inventory by naming the items the player has as elements in the list. You'd also use lists like this to pass to the shop function to give it the list of items that "shop" has for sale (I'd add an optional second argument to my shop handler for a discount/gouge factor). Other thing the shop handler would need to know is the player's on hand cash and player's current inventory (if you want to prevent buying more than one of something).
Edit: I forgot to mention that your shop handler would look up items with code that looks like
Code: Select all
$ what='apple'
$ price=items[what]
e "Your %(what)s costs %(price)d quid."