By Edward Drescher
NXT: Whack-A-Brick 1.0By Edward Drescher
This is the beginning of a program called Whack-A-Brick. It is a game for your NXT that is a lot like whack-a-mole.
The NXT waits for the user to press the orange button, and then it starts the game. A brick will appear above the
left, right, or orange button and then waits for the user to press it. If the user doesn’t press the button before the
time is up (about 1.2 seconds at the start) then the game is over. If the user does press it in time, then the user
gets a point, the brick explodes, and then another one appears. As each brick appears, it makes a low sound to
get the user’s attention. During the next few issues the LCCW, I am going to go step-by-step through this program.
When you finish, you will have learned about more of the NXT programming blocks. There is a challenge section at
the end for you to try... Have fun! There are four different sections to this program and the first section is shown below.

Making the program:
for these. Each of these starts on a new line of the screen to make it all fit. Block 1’s Action should be Text. The
display should be cleared (Clear checked), and for the actual text type in, “Whack-a-Brick”. This should be on Line
1. Block 2’s Action should also be Text. Clear should be unchecked, and for Text type in, “Press the button”. This
should be on line three. For Block 3, Action-Text, don’t Clear, and text-“Under the bricks” should be on line four.
Keep going! There are only five more blocks to do! Block 4 Action-Text, don’t Clear, and text-“to whack them”. This
should be on line five. Block 5 should be the same as 4, but the text should be “when they appear” on line six.
Block 6 should also be the same as 5, but the text should be, “Orange to start” on line 8. Good going, you have all
the instructions done! Now there are only two more blocks left! Block 7 should be a Wait block, and the Control
should Sensor, the Sensor should be NXT Buttons, and the Button should be Enter Button. The Action should be
Bumped. So far, you’ve told the NXT to display the instructions and now you’ve told it to wait for the start button to
be pressed. The last block in Section 1 is a Display block, Action should be Reset. That’s it! You’re done with
Section 1! The last block told the NXT to clear the display so the user could play the game. That wasn’t too bad,
now was it? When you are done with everything (Sections 1-4) you will have a fun game to play and show your
buddies. You also should learn more and be able to do more with NXT programming!
0 comments:
Post a Comment