Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to Make an Upgrade Game | Part 1 | ItsMarbles
- ItsMarbles
-
31 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
In my short couple years of being on scratch, I have noticed a lack for upgrade games. I first assumed they had put a ban on them, but then reconsidered. Despite Scratch having roughly 8.5 million projects, only a handful of upgrade games are decent. This article is about showing people how to make a proper upgrade game. Remember. I am not teaching you to copy me. This is merely a guideline. Switch things up a bit! See what will happen!
Step 0.
Before we start, we need to create two variables. One named “Money”. Make sure you check “For All Sprites” before creating. The second one we can call isPurchased1. For every item we will make in the upgrade shop, we will need to create another isPurchased variable. I.e. isPurchased2, isPurchased3, isPurchased4. Make sure you assign these to the proper sprite and check “For This Sprite Only”, or you will end up with some major issues later on.
Step 1.
Perfect. Now, let's say the player has collected $500. We want him to be able to buy a speed upgrade for $250. Click on the speed upgrade button / sprite and put in the following script:
This makes it so that if the player has over $249, it will take away $250 from your money. If the player has less than $250, it will tell you you don't have enough money. The play sound and say blocks are optional and are in no way required.
Step 2.
Repeat this script and paste it into all your other upgrades and change 250 to their price. Once you have finished, you will need to set the isPurchased variable to 1. To do this, add this block to your script.
Great! Now that it sets isPurchased to 1 once purchased, you will need to test for if the isPurchased variable is set to 1. This will trigger a set of commands to prevent the player from purchasing it needlessly again. To do so, add this to our set of blocks.
Again, the say block is optional. In doing this this insures that the player can't buy items he has already purchased. Without this, your player would end up buying the same upgrades time and time again.
This concludes my upgrade game tutorial. The rest is up to you. Will you make an endless platformer with upgrades? A car racing game? How will players get money? If you want, here is one homework assignment. Try making endless upgrades. Upgrades that continue to increase in price and go on forever. Finished my little assignment? Post a link to your project in the comments below! Feedback is much appreciated!
Step 0.
Before we start, we need to create two variables. One named “Money”. Make sure you check “For All Sprites” before creating. The second one we can call isPurchased1. For every item we will make in the upgrade shop, we will need to create another isPurchased variable. I.e. isPurchased2, isPurchased3, isPurchased4. Make sure you assign these to the proper sprite and check “For This Sprite Only”, or you will end up with some major issues later on.
Step 1.
Perfect. Now, let's say the player has collected $500. We want him to be able to buy a speed upgrade for $250. Click on the speed upgrade button / sprite and put in the following script:
This makes it so that if the player has over $249, it will take away $250 from your money. If the player has less than $250, it will tell you you don't have enough money. The play sound and say blocks are optional and are in no way required.
Step 2.
Repeat this script and paste it into all your other upgrades and change 250 to their price. Once you have finished, you will need to set the isPurchased variable to 1. To do this, add this block to your script.
Great! Now that it sets isPurchased to 1 once purchased, you will need to test for if the isPurchased variable is set to 1. This will trigger a set of commands to prevent the player from purchasing it needlessly again. To do so, add this to our set of blocks.
Again, the say block is optional. In doing this this insures that the player can't buy items he has already purchased. Without this, your player would end up buying the same upgrades time and time again.
This concludes my upgrade game tutorial. The rest is up to you. Will you make an endless platformer with upgrades? A car racing game? How will players get money? If you want, here is one homework assignment. Try making endless upgrades. Upgrades that continue to increase in price and go on forever. Finished my little assignment? Post a link to your project in the comments below! Feedback is much appreciated!
Last edited by ItsMarbles (March 19, 2015 11:14:51)
- CatsUnited
-
1000+ posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Many, if not most projects are blank or just very simple with default sprites.
- ItsMarbles
-
31 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Yes. That is true. Thank you for your constructive criticism! Many, if not most projects are blank or just very simple with default sprites.
- TheCreeper876
-
1 post
How to Make an Upgrade Game | Part 1 | ItsMarbles
I think that the bottom block (at the end) should be moved to the top of the script because you would otherwise get the item, spend the money, but then it would say “You already bought this item!” but you would still pay the money. Furthermore, you should use an “If/Else” block with “If not isPurchased=1, then <insert buying command>, else <insert rejection command>. You can also use nested ”If/Else" blocks to make the buying, the rejection from not enough and the rejection from already bought. Hope this helps to make it work!
I'm actually planning to make my own upgrade game

I'm actually planning to make my own upgrade game


Last edited by TheCreeper876 (April 26, 2016 19:57:55)
- Eugene-Chinese
-
1 post
How to Make an Upgrade Game | Part 1 | ItsMarbles
Nice it worked
Last edited by Eugene-Chinese (July 9, 2016 10:09:23)
- wezalecoGAMES-
-
3 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
oh why did it not work!!!
- Xtreme_OverLord
-
4 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
It didn't work… Am i supposed to magically create a black that can have a Variable in it???!?!?!?!?!?!?!?!?!!
- Xtreme_OverLord
-
4 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Its sooo frusterating i can't add a Variable to an if then block!
- Xtreme_OverLord
-
4 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Wait, I got it thanks!
- ItsMarbles
-
31 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
I made this tutorial a long time ago, so I'm pretty sure it isn't the best way of doing this. Please explain what you're having trouble with so I can help. oh why did it not work!!!
- ProShark26
-
100+ posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Xtreme_OverLord, you aren't supposed to add a variable block to an if then block, you will need to put it into an operator block that looks like this
except put one “foo” in each box and put the front of the green block next to/in the part that looks like it's dimmer and has six sides.
hope I help=<^.^>=
Check out my levels as well. Heres one of them. Your text to link here…
PLZ!!!
except put one “foo” in each box and put the front of the green block next to/in the part that looks like it's dimmer and has six sides.
hope I help=<^.^>=

PLZ!!!
- ItsMarbles
-
31 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
In the future, I would avoid commenting on old threads like this, it's best to just let outdated tutorials die
.

Xtreme_OverLord, you aren't supposed to add a variable block to an if then block, you will need to put it into an operator block that looks like this
except put one “foo” in each box and put the front of the green block next to/in the part that looks like it's dimmer and has six sides.
hope I help=<^.^>=Check out my levels as well. Heres one of them. Your text to link here…
PLZ!!!
- 098765432154321
-
500+ posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
1 for everyone: Please DON'T NECROPOST. This topic is from 2015 and you guys are bumping it back to the top.
2 for ItsMarbles: Please don't post random tutorials on different forums. Show and Tell is best for this.
I'm surprisingly the first one to post these warnings.
2 for ItsMarbles: Please don't post random tutorials on different forums. Show and Tell is best for this.
I'm surprisingly the first one to post these warnings.
- ItsMarbles
-
31 posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
Yo what I haven't been on this account in years lmao 1 for everyone: Please DON'T NECROPOST. This topic is from 2015 and you guys are bumping it back to the top.
2 for ItsMarbles: Please don't post random tutorials on different forums. Show and Tell is best for this.
I'm surprisingly the first one to post these warnings.
- Madcatofdoom
-
500+ posts
How to Make an Upgrade Game | Part 1 | ItsMarbles
And… you necroposted. Also, to 098765432154321, back then, it wasn't like the well moderated forums of today.Yo what I haven't been on this account in years lmao 1 for everyone: Please DON'T NECROPOST. This topic is from 2015 and you guys are bumping it back to the top.
2 for ItsMarbles: Please don't post random tutorials on different forums. Show and Tell is best for this.
I'm surprisingly the first one to post these warnings.
- Discussion Forums
- » Help with Scripts
-
» How to Make an Upgrade Game | Part 1 | ItsMarbles