This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-14 11:22:45

goodiesohhi
New Scratcher
Registered: 2012-04-14
Posts: 3

Help making shops

I need help making shops for buying things I already have the money established.

Offline

 

#2 2012-04-14 11:37:33

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Help making shops

Have the items people can buy in the shop as sprites, and call them up using a broadcast when the person enters the shop. You will need to make a variable, but I assume you have, if you have the money.

When [Potion_Red] clicked
change [money v] by [-1]
say [You bought potion!]
In that example, the person would lose 1 of their money for buying the "potion" and then it tells them they have bought it successfully.

Inversely, you could have the person sell their "Red Potion" by making it change money by 1.


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#3 2012-04-19 11:26:41

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Help making shops

Or:

When [potion] clicked
change [money v] by [-1]
add [potion] to [items v]
that way, the game remembers that you have bought it. When you need to use it, do something like:
forever
if <action happens>
if <[items v] contains [potion]>
do action involving potion
end
end
end


http://i46.tinypic.com/ao03lk.png

Offline

 

#4 2012-05-14 12:52:25

AgentRoop
Scratcher
Registered: 2012-02-11
Posts: 1000+

Re: Help making shops

You also have to take into account that you can only buy someting if you have enough money, so try this:

When [potion v] clicked
if < (money) < (1) >
  say [you don't have enough money!] for (2) secs
else
  change [money v] by (-1)
  add [potion] to [items v]
end
that should work.  smile


La La
I wrote an album.

Offline

 

Board footer