arrow_back Post a Shoutout
In this add-on, you will code your program to allow users to give a shoutout on your profile page.
Notice that the starter project has a section called "newest post."
You will code the Shoutout sprite to say or think a shoutout in this section.
Start by clicking the Shoutout sprite.
Next, program the sprite to ask the user for a post when it’s clicked.
Add a "when this sprite is clicked" block from the events menu, then an "ask" block from the sensing menu, and snap them together.
The Android doesn’t have to ask a question every time the "ask" block is used.
It can simply make a request from the user that will display a text box.
In this example, the sprite says "Add a post!" in the "ask" block.
Recall that you can see the answer on the screen if you click the checkbox beside the "answer" block.
Next, click on the looks menu, and drag out a "think" block into the scripts editor.
When you click on this block, the Shoutout sprite*thinks* "hmm."
For this project, you can use the "say" block to get a similar effect.
Use what works best for your program.
This example uses the "think" block.
Snap this block under the "ask" block.
To make the Android post the user’s answer, drag the "answer" block from the sensing menu, and put it inside the "think" block.
Now test it.
When the sprite is clicked, the Shoutout sprite asks the user to "Add a post!"
This example adds "I love tacos too!
This page is awesome."
Then, the Shoutout sprite says the post!
Which is awesome.
Now it’s your turn: Program the Shoutout sprite to ask the user for a post when it’s clicked.
Then, program the sprite to think the answer.
When you’re done, ask your neighbor to test out your program by posting a shoutout!