Introduction: Blockland Tutorial - How to Make Something Cost "money".
In this tutorial I will show you how to setup a brick or object cost "money" when you interact with it. Bare in mind I will be using the in game player score as a source of money, using this method for money means you can get player scores in the negatives.
Step 1:
First off we need something to give us money in this case I have made the Green Cup give you 1 point when you shoot it.
OnProjectileHit>Client>IncScore>1
OnProjectileHit>Client>IncScore>1
Step 2:
Ok time to get a cup of coffee! Now we are going to setup the Blue Cup to take away 1 from the score, show a message and cause the cup to move.
The first of the events is
OnProjectileHit>Client>IncScore>[-1]
You should recognize this one from the Green Cup the only change is the minus symbol before the one. This tells the game to take one away from your score.
The second event is
OnActivate>Self>FakeKillBrick>[] [-5] [] [5]
What this does is when you click on it (OnActivate) the brick (Self) moves (FakeKillBrick) in a direction of your choosing ([] [-5] []) and then it re-appears after 5 seconds([5]). The direction you want it to go in might need to be edited, all you need to do is move around the -5 to see where the cup or brick goes.
The third event is
OnActivate>Client>BottomPrint>[You have bought a cup of Coffee.] [3]
What this does is when you click on it (OnActivate) the game (Client) prints on the bottom of your game (BottomPrint) a message of your choosing([You have bought a cup of Coffee.]) for a set amount of time in seconds([3]).
The first of the events is
OnProjectileHit>Client>IncScore>[-1]
You should recognize this one from the Green Cup the only change is the minus symbol before the one. This tells the game to take one away from your score.
The second event is
OnActivate>Self>FakeKillBrick>[] [-5] [] [5]
What this does is when you click on it (OnActivate) the brick (Self) moves (FakeKillBrick) in a direction of your choosing ([] [-5] []) and then it re-appears after 5 seconds([5]). The direction you want it to go in might need to be edited, all you need to do is move around the -5 to see where the cup or brick goes.
The third event is
OnActivate>Client>BottomPrint>[You have bought a cup of Coffee.] [3]
What this does is when you click on it (OnActivate) the game (Client) prints on the bottom of your game (BottomPrint) a message of your choosing([You have bought a cup of Coffee.]) for a set amount of time in seconds([3]).
Step 3:
Ok you now have a cup of coffee that you can buy. What were going to do in this step is make it look better. I did not get a screenshot of the first step like an idiot.
The white cup has the same events that the blue cup has with the exception of the last step It has been tweaked a little bit. It now looks like
OnActivate>Client>BottomPrint>[<color:ffffff>You have bought a cup of Coffee.] [3]
All this does is change the color of the text to white. When you use the color command it has to have a Hex Color Code.
The Yellow Cup has the same events as the Blue and White cup the only difference is we added an extra color. It now looks like
OnActivate>Client>BottomPrint>[<color:ffffff>You have bought a cup of <color:996633>Coffee<color:ffffff>.] [3]
Now what this does is the first color code (<color:ffffff>) turns the text white until it reaches the second color code(<color:996633>) which then changes the color to a light brown until it reaches the next color code (<color:ffffff>) which changes it back to white.
The white cup has the same events that the blue cup has with the exception of the last step It has been tweaked a little bit. It now looks like
OnActivate>Client>BottomPrint>[<color:ffffff>You have bought a cup of Coffee.] [3]
All this does is change the color of the text to white. When you use the color command it has to have a Hex Color Code.
The Yellow Cup has the same events as the Blue and White cup the only difference is we added an extra color. It now looks like
OnActivate>Client>BottomPrint>[<color:ffffff>You have bought a cup of <color:996633>Coffee<color:ffffff>.] [3]
Now what this does is the first color code (<color:ffffff>) turns the text white until it reaches the second color code(<color:996633>) which then changes the color to a light brown until it reaches the next color code (<color:ffffff>) which changes it back to white.