Social media sites have ways
to like or love different things,
whether it's a post, a picture, or a status.
Whenever it's clicked,
it indicates that you liked something,
that it made you laugh,
or that you appreciate it.
In this add-on, you'll program a Plus One button
on your profile page so that users can express
that they liked your page.
In this starter project,
there's a Plus One My Page sprite
at the bottom of the stage.
First, create a variable.
Click on the Plus One sprite,
click the Make A Variable button,
and name it something that makes sense
for the sprite you've created.
This example names the variable Plus One
which shows up on the top corner of the stage.
Remember that a variable holds and stores a value.
For this add-on, the project will store
how many people click the Plus One button
and like the page.
Move the Plus One display box
over to the Plus My Page sprite
and double click the display box
to make it appear larger on the stage
just like you did in the previous videos.
Next, code the Plus One button to increase by one
every time the sprite is clicked.
Drag out the Change Plus One By One block
into the Scripts Editor.
When you click on this block
the variable increases by one.
If you change the value in the block
to a larger number, like 10, then every time
you click the block, the variable increases by 10.
This example uses one in the value.
Since the variable should increase
when the sprite is clicked,
add a When This Sprite Clicked event from the Events menu.
Test your code.
When the sprite is clicked, the page increase by one.
Finally, program the plus one count
to start at zero when the flag is clicked.
Drag out a Set Plus One To Zero block
into the Scripts Editor.
When you click this block,
the variable count goes to zero.
To make this code run when the flag is clicked
add a When Flag Clicked block to the top
of the Set Plus One To block.
Great and test it out.
When the flag is clicked, the variable count resets to zero.
Then when you click on the Plus One sprite
the count increases.
Now users can interact with your page
and show that they liked it.
Now it's your turn.
Create a Plus One variable for the Plus One sprite.
Code the variable to change by a value when it's clicked,
and reset when the flag is clicked.
Program a "plus 1" button so users can express that they liked your page.
Add music to your profile page.
Code your profile android to change its look
Program your friend's sprites to respond to your favorite stuff!
Code a surprising action on your profile page!
Sign in to track your progress and earn badges