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

#1 2013-03-15 07:37:30

crr12
New Scratcher
Registered: 2013-03-15
Posts: 1

Help!!!

Help! im making a game and i have a coin variable but i want the coin variable to dissapear when there isnt any coins left or just not let people buy things when its at zero

Offline

 

#2 2013-03-15 09:19:02

Harald
New Scratcher
Registered: 2013-03-05
Posts: 34

Re: Help!!!

when [Item] clicked
if <(coins) > [Cost of item]>
Purchase item
You can add this to all your purchaseable items. Hope it helps.

Offline

 

#3 2013-03-31 16:46:21

shivadas
Scratcher
Registered: 2010-02-06
Posts: 100+

Re: Help!!!

Harald wrote:

when [Item] clicked
if <(coins) > [Cost of item]>
Purchase item
You can add this to all your purchaseable items. Hope it helps.

You could do it that way, but I would do this just to be sure:

when [Item] clicked
if <(Coins) > (Item Cost)>
change [Coins  v] by (Item Cost)
else
say [You do not have enough money to purchase this item.] for [2] secs

Last edited by shivadas (2013-03-31 16:46:37)


Please check out my latest project, Hunger Avenger!

Offline

 

#4 2013-03-31 17:16:57

mathfreak231
Scratcher
Registered: 2012-10-24
Posts: 80

Re: Help!!!

shivadas wrote:

Harald wrote:

when [Item] clicked
if <(coins) > [Cost of item]>
Purchase item
You can add this to all your purchaseable items. Hope it helps.

You could do it that way, but I would do this just to be sure:

when [Item] clicked
if <(Coins) > (Item Cost)>
change [Coins  v] by (Item Cost)
else
say [You do not have enough money to purchase this item.] for [2] secs

Make sure you use

change [Coins v] by (join [-] (Item Cost))
Which makes it subtract.


~This sig is false~
I'm on teh wiki!

Offline

 

#5 2013-03-31 17:23:43

shivadas
Scratcher
Registered: 2010-02-06
Posts: 100+

Re: Help!!!

mathfreak231 wrote:

shivadas wrote:

Harald wrote:

when [Item] clicked
if <(coins) > [Cost of item]>
Purchase item
You can add this to all your purchaseable items. Hope it helps.

You could do it that way, but I would do this just to be sure:

when [Item] clicked
if <(Coins) > (Item Cost)>
change [Coins  v] by (Item Cost)
else
say [You do not have enough money to purchase this item.] for [2] secs

Make sure you use

change [Coins v] by (join [-] (Item Cost))
Which makes it subtract.

Sorry, I missed that  smile


Please check out my latest project, Hunger Avenger!

Offline

 

Board footer