Computer Science Canada Rpg Shop... |
Author: | Unicornzrcool [ Thu Feb 05, 2009 5:27 pm ] | ||
Post subject: | Rpg Shop... | ||
Ok, here's my question, in the code below I have a shop scenario and the option to buy a weapon and a shield. However, you are able to buy as many of one item as you want. I was wondering if there was some way to change the code so you can only buy 1 of the object. Any help would be greatly appreciated!! =]
|
Author: | yusong [ Thu Feb 05, 2009 5:36 pm ] |
Post subject: | RE:Rpg Shop... |
var metalsword : bool := false if the player buys the sword, set it to true if metalsword is true, then make it so they cant buy it. |
Author: | Unicornzrcool [ Thu Feb 05, 2009 7:14 pm ] | ||
Post subject: | Re: Rpg Shop... | ||
Ok, I followed your instructions and it stops the player from buying more than one sword. However, it skips the part where it is supposed to say "you have already bought this item". Here is the code again with the part you said to add:
Is this even the correct way to put it in, and if so is there any way of making it so that it allows me to say that? Thanks! |
Author: | Zren [ Thu Feb 05, 2009 7:23 pm ] |
Post subject: | Re: Rpg Shop... |
btw, what happens when you have exactly 23 gold :S |
Author: | Unicornzrcool [ Thu Feb 05, 2009 10:45 pm ] |
Post subject: | Re: Rpg Shop... |
Haha nice I didn't notice that before. Thanks for pointing that out! |
Author: | TheGuardian001 [ Fri Feb 06, 2009 3:23 pm ] | ||||
Post subject: | Re: Rpg Shop... | ||||
why is
combined with the money checking if statement? think about how if/elsifs work.
it would make more sense if you combined the metalsword = true in to the same if then else statement as the metalsword = false. |