Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Hiding
- MonkeyRaceGod
- Scratcher
19 posts
Hiding
So on my clicker game I have a shop and i'm trying to make a sprite disappear when you buy it and another appear but I don't know how to do that.
- Kono_Muda_Da
- Scratcher
100+ posts
Hiding
to use the code below make sure that the new clicking item is in the same sprite. if you have 2 separate sprites and you need to use the new one ignore the first code below and focus on the 2nd code
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop item
Then go to the clicking and use this code
However, if the sprite you need is separate then the old clicking item use the code below
Then this code below is for the old sprite that is going to be switched
The final code below is for the 2nd sprite that is new
Hopefully this helps
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop item
when this sprite clicked
broadcast [ costume]
Then go to the clicking and use this code
when I receive [ costume]
switch costume to [ the costume you want]
However, if the sprite you need is separate then the old clicking item use the code below
when this sprite clicked
broadcast [ costume]
Then this code below is for the old sprite that is going to be switched
when I receive [ costume]
hide
The final code below is for the 2nd sprite that is new
when I receive [ costume]
show
Hopefully this helps
Last edited by Kono_Muda_Da (Feb. 7, 2022 23:18:06)
heheh my own banner
when I receive [jojo reference v]
say [IS THAT A JOJO REFERENCE]
switch costume to [NO WAYYYYY v]
repeat until <[jojo reference] = [0]>
turn cw (1) degrees
set [ mosiac v] effect to (100)
change [color v] effect by (25)
end
Check out my profile!
Wow! My 100th post already!
My greatest project!
My second greatest project!
H̸̨̧̧̧͍͕͖̫͉͙̦̖̳̦͔̪͇̫̫̲̞͚͈̼̺̟͖̯͔̱̭̬̰̗͎͖͎̘͊͒̋́̉̒̿̈̇͛̓̑̀̈́̊̀͑̋̓̃́͋̊̎̏͐͗͊̄̌͊̽̇̆̀̈̄͌̏̔̅͒́͆̊̉̑̄̾̕̚̚̚͘͘͜͝͠͝͝͝͝͝ ̸̨̛̦͙̱̗̦̯͑̓̅͋͂̿́̔̇͌͒̊́͐̒͗́̒̑̾̎̕̕̕͘̕͝E̶̻̼͓̯͛͛̄͂̓́̈̈́̈́̈́͂͐̚͘͠ ̷̨̨̡̢̧̢̨̤̩̪͚̭̠̼̣̝̲̼͙̥̘̺͎̫̤̲̖̘͔͍͉̫̭͇̞͖͔̠̤͚̞͇͚̹̥̊́̃̆͑͗̈́̈́̊̆̃̀̎͆̕͘͜͝H̵̢̡̗̬̩̺͍̥̪̘̅̑͒̓͋͑̐̿͂̇̅̄̐͐̉̈́̓̉̈́̈́̀̈́͘̚͠͠ ̶̨̛̲̪̝̬̻͗͒͆̀͂̓̈́̔́̊͒͊͐̃̑͑̃͒̂̆͗̀͛͂̔̀̕̕͘̕͜͠E̸̡̧̡̜̙͓͖̻̰̥̹̞͉͔̹̦͈͇̤͎̜̗̼̹̒̽͐̅̆̅͑̀̂͊͂̀̉̊̀̾̓͊̉͋̍̏͂͑̓̿̑̑͊̎̓̍̓͗̀̇̈̏͛̆̏̈́͂̈́͛̈̄̋͘̕͝͝ ̵̛̛̤̟̤̾̽̿͌́̂̈͂̀̐̃̂͒̂̈͌̽̋̂̑́̈́̃͋͗̉̅̀̋͂̏̽̿̇̀̑͑̑̌͌̈́̀̔̆̊̕̚̚͘̕͘͘͝͝͝͝͝H̵̨̡̡̨̧̢̛̛͎͎̼̯͕̰͖͙̣̠̳̭͚̙̱̲̙͔̞̥̻͎͎̱̫̜̖̣̩̜̯̯͎̮̊̾̿̐̈͗̅́̒̄͛̂̒͂̆̂̽̂̍͂̑̀͘̕͝͝͝͝͝ͅ ̴̖̻̝͇̻̻̻̗͚̼͍͛̏͌̿̏̓̐̂͛̉͑͗̆͋̈̿́̌̔̈́̈́̃̕ͅĘ̵̧̧̡̝̣̪͕̩̖̗̖̜͎͇͚͎̻̘̮͈͉͎̳͓̜̳͇͇͖̬͍͖̲͎͖͇̗̠̥̭̮͉̰̻͓͍̘̮̼͓͒͗̌̍̓̔̕͜͝͠͠͠ͅͅ ̷̮̤̦͉̣͉͍̠̪̺̍̉͗̇́̋̎͛̑̓̂̈́̑̒́̈́̑̕̕͠ͅH̸̨̧̡̛̛̫̥̱̲̲̞͍̬̫͉̭̮̗̳͙̱̲̪́́͐̋͛̒̌͐̾̍́̄̂̀́̆͋̎̓͐̓̓̌̔͋̄́̓́̇̇͐̑̕̚͘̚͠͝ ̸̢̛̺͚̝̜̙͇͍͙̬̰̳̗̳̙̭̭͉̫̝̊̌͆͑̓́́̓͛̅̀͊̀̑̊̇̂̐̋͐͘͝͝͝͝͝ͅͅA̶̡̧̢͕͉̼̰̗̬̲̱̼̹̰͓̫̤̯̹̩̫̪̗̹͔̙̝͇͍̤̗͈͇̠̺̩̲̹̙̪̞̦̘̼͔̠̦͒̾͌̐̏͌͐͐̊͆̀̋̈́͒̒͋͒́̎͆̋̐̽̍̂̔̾͌́̃͒̓̒̕͘̚͜͝͠͝ͅͅͅ ̷̧̡̧̝̥̺͕̺̜̙͉̬͔͈͕̳̌̑̅̎͂̏̃̀̓̎̍͂̎͘ͅW̵̧̢̡̢̡̡̨̨̡̛̛̛͇̤̪̠̤̟͇̰̼̥̼̗̯̺̳̦̩͎̹͔̜̘̹̥̖̙͍͎̬̾͌̈͋́̾̈́̈͊̐̑̈́̈́̀̄̽̽͂̉͊͂́͊̃̓̀͊̌̄̃̽̓̍̄̌͋̉͘̕͜͝͝ͅ ̴̧̢̺̹̺̜̞͔̖̩̞͖̼̖̞̬̼̓́̉̄͋̈́̇͑̇̽́͘̕͝͝͠
- D-ScratchNinja
- Scratcher
1000+ posts
Hiding
Alright, first you need to keep track of whether you've already bought that item. You can add a variable for each shop item and change it after you bought the item, like so:
To make sure that item is not available after you buy it, you need to be able to show it when it is available and hide it when it's not. You can constantly check using a forever loop, or have the sprite wait until the item is available, then show, and then wait until it is not available, then hide. That would look like this:
If you want to unlock a different item after you buy one item and you are using for-sprite variables, you can use a broadcast to make another sprite update its variable to unlock a second item. You could add this block to your script to buy the first item:
If you're using global variables, then you can simply change that variable and the other sprite will show up assuming it has a copy of the code.
I hope this was helpful. You can let me know if anything is unclear.
when this sprite clicked
if <not<($) < (cost :: grey)>> then
change [item A count v] by (1)
set [item is for sale v] to [false]
end
To make sure that item is not available after you buy it, you need to be able to show it when it is available and hide it when it's not. You can constantly check using a forever loop, or have the sprite wait until the item is available, then show, and then wait until it is not available, then hide. That would look like this:
when I receive [open shop v]
wait until <(item is for sale) = [true]>
show
wait until <(item is for sale) = [false]>
hide
If you want to unlock a different item after you buy one item and you are using for-sprite variables, you can use a broadcast to make another sprite update its variable to unlock a second item. You could add this block to your script to buy the first item:
broadcast [unlock item B v]Then, on the other sprite for the other item, add this code:
when I receive [unlock item B v]
set [item is for sale v] to [false]
If you're using global variables, then you can simply change that variable and the other sprite will show up assuming it has a copy of the code.
I hope this was helpful. You can let me know if anything is unclear.
Last edited by D-ScratchNinja (Feb. 7, 2022 23:18:11)
D-ScratchNinja • he/him
- The following is my signature, which always shows up below my posts. -
New! Filter through my projects with my website.
Need to fix an issue? Check out this studio for solutions to some common problems!
OS: Windows 11 / Browser: Microsoft Edge / Time zone: PST/PDT
- MonkeyRaceGod
- Scratcher
19 posts
Hiding
to use the code below make sure that the new clicking item is in the same sprite. if you have 2 separate sprites and you need to use the new one ignore the first code below and focus on the 2nd code
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop itemwhen this sprite clicked
broadcast [ costume]
Then go to the clicking and use this codewhen I receive [ costume]
switch costume to [ the costume you want]
However, if the sprite you need is separate then the old clicking item use the code belowwhen this sprite clicked
broadcast [ costume]
Then this code below is for the old sprite that is going to be switchedwhen I receive [ costume]
hide
The final code below is for the 2nd sprite that is newwhen I receive [ costume]
show
Hopefully this helps
Ok I did this but like the thing I have is I press a shop button that opens up this upgrade so when i buy it the upgrade disappears and the new one appears but when I close the shop and reopen it its now gone
- Kono_Muda_Da
- Scratcher
100+ posts
Hiding
Make sure that your code for the upgrade is liketo use the code below make sure that the new clicking item is in the same sprite. if you have 2 separate sprites and you need to use the new one ignore the first code below and focus on the 2nd code
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop itemwhen this sprite clicked
broadcast [ costume]
Then go to the clicking and use this codewhen I receive [ costume]
switch costume to [ the costume you want]
However, if the sprite you need is separate then the old clicking item use the code belowwhen this sprite clicked
broadcast [ costume]
Then this code below is for the old sprite that is going to be switchedwhen I receive [ costume]
hide
The final code below is for the 2nd sprite that is newwhen I receive [ costume]
show
Hopefully this helps
Ok I did this but like the thing I have is I press a shop button that opens up this upgrade so when i buy it the upgrade disappears and the new one appears but when I close the shop and reopen it its now gone
when I receive [ shop]
show
this makes sure every time you click the shop button it will appear
heheh my own banner
when I receive [jojo reference v]
say [IS THAT A JOJO REFERENCE]
switch costume to [NO WAYYYYY v]
repeat until <[jojo reference] = [0]>
turn cw (1) degrees
set [ mosiac v] effect to (100)
change [color v] effect by (25)
end
Check out my profile!
Wow! My 100th post already!
My greatest project!
My second greatest project!
H̸̨̧̧̧͍͕͖̫͉͙̦̖̳̦͔̪͇̫̫̲̞͚͈̼̺̟͖̯͔̱̭̬̰̗͎͖͎̘͊͒̋́̉̒̿̈̇͛̓̑̀̈́̊̀͑̋̓̃́͋̊̎̏͐͗͊̄̌͊̽̇̆̀̈̄͌̏̔̅͒́͆̊̉̑̄̾̕̚̚̚͘͘͜͝͠͝͝͝͝͝ ̸̨̛̦͙̱̗̦̯͑̓̅͋͂̿́̔̇͌͒̊́͐̒͗́̒̑̾̎̕̕̕͘̕͝E̶̻̼͓̯͛͛̄͂̓́̈̈́̈́̈́͂͐̚͘͠ ̷̨̨̡̢̧̢̨̤̩̪͚̭̠̼̣̝̲̼͙̥̘̺͎̫̤̲̖̘͔͍͉̫̭͇̞͖͔̠̤͚̞͇͚̹̥̊́̃̆͑͗̈́̈́̊̆̃̀̎͆̕͘͜͝H̵̢̡̗̬̩̺͍̥̪̘̅̑͒̓͋͑̐̿͂̇̅̄̐͐̉̈́̓̉̈́̈́̀̈́͘̚͠͠ ̶̨̛̲̪̝̬̻͗͒͆̀͂̓̈́̔́̊͒͊͐̃̑͑̃͒̂̆͗̀͛͂̔̀̕̕͘̕͜͠E̸̡̧̡̜̙͓͖̻̰̥̹̞͉͔̹̦͈͇̤͎̜̗̼̹̒̽͐̅̆̅͑̀̂͊͂̀̉̊̀̾̓͊̉͋̍̏͂͑̓̿̑̑͊̎̓̍̓͗̀̇̈̏͛̆̏̈́͂̈́͛̈̄̋͘̕͝͝ ̵̛̛̤̟̤̾̽̿͌́̂̈͂̀̐̃̂͒̂̈͌̽̋̂̑́̈́̃͋͗̉̅̀̋͂̏̽̿̇̀̑͑̑̌͌̈́̀̔̆̊̕̚̚͘̕͘͘͝͝͝͝͝H̵̨̡̡̨̧̢̛̛͎͎̼̯͕̰͖͙̣̠̳̭͚̙̱̲̙͔̞̥̻͎͎̱̫̜̖̣̩̜̯̯͎̮̊̾̿̐̈͗̅́̒̄͛̂̒͂̆̂̽̂̍͂̑̀͘̕͝͝͝͝͝ͅ ̴̖̻̝͇̻̻̻̗͚̼͍͛̏͌̿̏̓̐̂͛̉͑͗̆͋̈̿́̌̔̈́̈́̃̕ͅĘ̵̧̧̡̝̣̪͕̩̖̗̖̜͎͇͚͎̻̘̮͈͉͎̳͓̜̳͇͇͖̬͍͖̲͎͖͇̗̠̥̭̮͉̰̻͓͍̘̮̼͓͒͗̌̍̓̔̕͜͝͠͠͠ͅͅ ̷̮̤̦͉̣͉͍̠̪̺̍̉͗̇́̋̎͛̑̓̂̈́̑̒́̈́̑̕̕͠ͅH̸̨̧̡̛̛̫̥̱̲̲̞͍̬̫͉̭̮̗̳͙̱̲̪́́͐̋͛̒̌͐̾̍́̄̂̀́̆͋̎̓͐̓̓̌̔͋̄́̓́̇̇͐̑̕̚͘̚͠͝ ̸̢̛̺͚̝̜̙͇͍͙̬̰̳̗̳̙̭̭͉̫̝̊̌͆͑̓́́̓͛̅̀͊̀̑̊̇̂̐̋͐͘͝͝͝͝͝ͅͅA̶̡̧̢͕͉̼̰̗̬̲̱̼̹̰͓̫̤̯̹̩̫̪̗̹͔̙̝͇͍̤̗͈͇̠̺̩̲̹̙̪̞̦̘̼͔̠̦͒̾͌̐̏͌͐͐̊͆̀̋̈́͒̒͋͒́̎͆̋̐̽̍̂̔̾͌́̃͒̓̒̕͘̚͜͝͠͝ͅͅͅ ̷̧̡̧̝̥̺͕̺̜̙͉̬͔͈͕̳̌̑̅̎͂̏̃̀̓̎̍͂̎͘ͅW̵̧̢̡̢̡̡̨̨̡̛̛̛͇̤̪̠̤̟͇̰̼̥̼̗̯̺̳̦̩͎̹͔̜̘̹̥̖̙͍͎̬̾͌̈͋́̾̈́̈͊̐̑̈́̈́̀̄̽̽͂̉͊͂́͊̃̓̀͊̌̄̃̽̓̍̄̌͋̉͘̕͜͝͝ͅ ̴̧̢̺̹̺̜̞͔̖̩̞͖̼̖̞̬̼̓́̉̄͋̈́̇͑̇̽́͘̕͝͝͠
- MonkeyRaceGod
- Scratcher
19 posts
Hiding
Make sure that your code for the upgrade is liketo use the code below make sure that the new clicking item is in the same sprite. if you have 2 separate sprites and you need to use the new one ignore the first code below and focus on the 2nd code
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop itemwhen this sprite clicked
broadcast [ costume]
Then go to the clicking and use this codewhen I receive [ costume]
switch costume to [ the costume you want]
However, if the sprite you need is separate then the old clicking item use the code belowwhen this sprite clicked
broadcast [ costume]
Then this code below is for the old sprite that is going to be switchedwhen I receive [ costume]
hide
The final code below is for the 2nd sprite that is newwhen I receive [ costume]
show
Hopefully this helps
Ok I did this but like the thing I have is I press a shop button that opens up this upgrade so when i buy it the upgrade disappears and the new one appears but when I close the shop and reopen it its now gonewhen I receive [ shop]
show
this makes sure every time you click the shop button it will appear
If I have the show when I open it it wont be hidden and it will be stacked on the other one i'm trying to make it like when I buy the first upgrade the second will now appear when you open the shop and the first wont.
- Kono_Muda_Da
- Scratcher
100+ posts
Hiding
Make sure that your code for the upgrade is liketo use the code below make sure that the new clicking item is in the same sprite. if you have 2 separate sprites and you need to use the new one ignore the first code below and focus on the 2nd code
This code below is for 2 costumes in one sprite
The (when this sprite clicked) refers to the shop itemwhen this sprite clicked
broadcast [ costume]
Then go to the clicking and use this codewhen I receive [ costume]
switch costume to [ the costume you want]
However, if the sprite you need is separate then the old clicking item use the code belowwhen this sprite clicked
broadcast [ costume]
Then this code below is for the old sprite that is going to be switchedwhen I receive [ costume]
hide
The final code below is for the 2nd sprite that is newwhen I receive [ costume]
show
Hopefully this helps
Ok I did this but like the thing I have is I press a shop button that opens up this upgrade so when i buy it the upgrade disappears and the new one appears but when I close the shop and reopen it its now gonewhen I receive [ shop]
show
this makes sure every time you click the shop button it will appear
If I have the show when I open it it wont be hidden and it will be stacked on the other one i'm trying to make it like when I buy the first upgrade the second will now appear when you open the shop and the first wont.
Oh ok
so first when you click the shop button and you click the first upgrade that changes the costume do this
when this sprite clicked
broadcast [ costume]
go to back
then copy this code for the 2nd upgrade so it will repeat itself when clicked
heheh my own banner
when I receive [jojo reference v]
say [IS THAT A JOJO REFERENCE]
switch costume to [NO WAYYYYY v]
repeat until <[jojo reference] = [0]>
turn cw (1) degrees
set [ mosiac v] effect to (100)
change [color v] effect by (25)
end
Check out my profile!
Wow! My 100th post already!
My greatest project!
My second greatest project!
H̸̨̧̧̧͍͕͖̫͉͙̦̖̳̦͔̪͇̫̫̲̞͚͈̼̺̟͖̯͔̱̭̬̰̗͎͖͎̘͊͒̋́̉̒̿̈̇͛̓̑̀̈́̊̀͑̋̓̃́͋̊̎̏͐͗͊̄̌͊̽̇̆̀̈̄͌̏̔̅͒́͆̊̉̑̄̾̕̚̚̚͘͘͜͝͠͝͝͝͝͝ ̸̨̛̦͙̱̗̦̯͑̓̅͋͂̿́̔̇͌͒̊́͐̒͗́̒̑̾̎̕̕̕͘̕͝E̶̻̼͓̯͛͛̄͂̓́̈̈́̈́̈́͂͐̚͘͠ ̷̨̨̡̢̧̢̨̤̩̪͚̭̠̼̣̝̲̼͙̥̘̺͎̫̤̲̖̘͔͍͉̫̭͇̞͖͔̠̤͚̞͇͚̹̥̊́̃̆͑͗̈́̈́̊̆̃̀̎͆̕͘͜͝H̵̢̡̗̬̩̺͍̥̪̘̅̑͒̓͋͑̐̿͂̇̅̄̐͐̉̈́̓̉̈́̈́̀̈́͘̚͠͠ ̶̨̛̲̪̝̬̻͗͒͆̀͂̓̈́̔́̊͒͊͐̃̑͑̃͒̂̆͗̀͛͂̔̀̕̕͘̕͜͠E̸̡̧̡̜̙͓͖̻̰̥̹̞͉͔̹̦͈͇̤͎̜̗̼̹̒̽͐̅̆̅͑̀̂͊͂̀̉̊̀̾̓͊̉͋̍̏͂͑̓̿̑̑͊̎̓̍̓͗̀̇̈̏͛̆̏̈́͂̈́͛̈̄̋͘̕͝͝ ̵̛̛̤̟̤̾̽̿͌́̂̈͂̀̐̃̂͒̂̈͌̽̋̂̑́̈́̃͋͗̉̅̀̋͂̏̽̿̇̀̑͑̑̌͌̈́̀̔̆̊̕̚̚͘̕͘͘͝͝͝͝͝H̵̨̡̡̨̧̢̛̛͎͎̼̯͕̰͖͙̣̠̳̭͚̙̱̲̙͔̞̥̻͎͎̱̫̜̖̣̩̜̯̯͎̮̊̾̿̐̈͗̅́̒̄͛̂̒͂̆̂̽̂̍͂̑̀͘̕͝͝͝͝͝ͅ ̴̖̻̝͇̻̻̻̗͚̼͍͛̏͌̿̏̓̐̂͛̉͑͗̆͋̈̿́̌̔̈́̈́̃̕ͅĘ̵̧̧̡̝̣̪͕̩̖̗̖̜͎͇͚͎̻̘̮͈͉͎̳͓̜̳͇͇͖̬͍͖̲͎͖͇̗̠̥̭̮͉̰̻͓͍̘̮̼͓͒͗̌̍̓̔̕͜͝͠͠͠ͅͅ ̷̮̤̦͉̣͉͍̠̪̺̍̉͗̇́̋̎͛̑̓̂̈́̑̒́̈́̑̕̕͠ͅH̸̨̧̡̛̛̫̥̱̲̲̞͍̬̫͉̭̮̗̳͙̱̲̪́́͐̋͛̒̌͐̾̍́̄̂̀́̆͋̎̓͐̓̓̌̔͋̄́̓́̇̇͐̑̕̚͘̚͠͝ ̸̢̛̺͚̝̜̙͇͍͙̬̰̳̗̳̙̭̭͉̫̝̊̌͆͑̓́́̓͛̅̀͊̀̑̊̇̂̐̋͐͘͝͝͝͝͝ͅͅA̶̡̧̢͕͉̼̰̗̬̲̱̼̹̰͓̫̤̯̹̩̫̪̗̹͔̙̝͇͍̤̗͈͇̠̺̩̲̹̙̪̞̦̘̼͔̠̦͒̾͌̐̏͌͐͐̊͆̀̋̈́͒̒͋͒́̎͆̋̐̽̍̂̔̾͌́̃͒̓̒̕͘̚͜͝͠͝ͅͅͅ ̷̧̡̧̝̥̺͕̺̜̙͉̬͔͈͕̳̌̑̅̎͂̏̃̀̓̎̍͂̎͘ͅW̵̧̢̡̢̡̡̨̨̡̛̛̛͇̤̪̠̤̟͇̰̼̥̼̗̯̺̳̦̩͎̹͔̜̘̹̥̖̙͍͎̬̾͌̈͋́̾̈́̈͊̐̑̈́̈́̀̄̽̽͂̉͊͂́͊̃̓̀͊̌̄̃̽̓̍̄̌͋̉͘̕͜͝͝ͅ ̴̧̢̺̹̺̜̞͔̖̩̞͖̼̖̞̬̼̓́̉̄͋̈́̇͑̇̽́͘̕͝͝͠
- D-ScratchNinja
- Scratcher
1000+ posts
Hiding
In case you didn't see, I also have a method here if you want to try it.Ok I did this but like the thing I have is I press a shop button that opens up this upgrade so when i buy it the upgrade disappears and the new one appears but when I close the shop and reopen it its now gone -snip-
D-ScratchNinja • he/him
- The following is my signature, which always shows up below my posts. -
New! Filter through my projects with my website.
Need to fix an issue? Check out this studio for solutions to some common problems!
OS: Windows 11 / Browser: Microsoft Edge / Time zone: PST/PDT
- MonkeyRaceGod
- Scratcher
19 posts
Hiding
Alright, first you need to keep track of whether you've already bought that item. You can add a variable for each shop item and change it after you bought the item, like so:when this sprite clicked
if <not<($) < (cost :: grey)>> then
change [item A count v] by (1)
set [item is for sale v] to [false]
end
To make sure that item is not available after you buy it, you need to be able to show it when it is available and hide it when it's not. You can constantly check using a forever loop, or have the sprite wait until the item is available, then show, and then wait until it is not available, then hide. That would look like this:when I receive [open shop v]
wait until <(item is for sale) = [true]>
show
wait until <(item is for sale) = [false]>
hide
If you want to unlock a different item after you buy one item and you are using for-sprite variables, you can use a broadcast to make another sprite update its variable to unlock a second item. You could add this block to your script to buy the first item:broadcast [unlock item B v]Then, on the other sprite for the other item, add this code:when I receive [unlock item B v]
set [item is for sale v] to [false]
If you're using global variables, then you can simply change that variable and the other sprite will show up assuming it has a copy of the code.
I hope this was helpful. You can let me know if anything is unclear.
Thanks I got it to work now
- Discussion Forums
- » Help with Scripts
- » Hiding