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

#1 2012-01-13 08:37:27

raaheron
New Scratcher
Registered: 2011-11-24
Posts: 17

Please help me ?

Ok this may sound confusing but any help would be nice , i am currently working on an adventure game and you recieve coins from killing monsters , after you recieve an amount of coins u can buy stuff from a shop , in the shop their are spells and after u purchase a spell it tells u what key to press to use the spell. i need help on how i can make the spell only used after it is purchased. right now if someone knew what to press before buying it they could use this spell. please help me it is killing me and this project wouldnt be as good if people could cheat like that!

Offline

 

#2 2012-01-13 10:38:14

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Please help me ?

Make a list, and call it something like "Spells purchased". Then, make it so that when the project starts, all items in that list are deleted. I'm presuming you're using broadcasts when the spell is purchased, so put this:

When I receive "Spell1 purchased"
Add "Spell1" to "Spells purchased"

Then, if for example, to use the spell you needed to press the "a" key, you'd put this script:

When key "a" pressed
If "Spells purchased" contains "Spell1"
  [Rest of script]
End if

That should work  wink

Last edited by RedRocker227 (2012-01-13 10:38:53)


Why

Offline

 

#3 2012-01-13 11:05:29

raaheron
New Scratcher
Registered: 2011-11-24
Posts: 17

Re: Please help me ?

Thank you very much it should work i am working on this part now =]

Offline

 

#4 2012-01-13 12:40:24

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Please help me ?

No problem  big_smile


Why

Offline

 

#5 2012-01-14 02:09:05

K-Jam
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: Please help me ?

make a variable called spell 1
then do something like:

<when[ space ]key pressed>
<if>
<( spell 1 <=> purchased )>
(put atack here)


http://images.inmagine.com/img/imagezoo/iz162/Iz162012.jpg COMPASS!!!

Offline

 

Board footer