Skip to main content

"High Striker" with PocketLab & ScratchX

Submitted by Rich on Sat, 09/01/2018 - 19:29

Carnival Games

Most everyone enjoys a carnival!  Some like the food--from cotton candy, to funnel cakes, to ice cream.  Others enjoy rides such as the carousel, Ferris wheel, and bumper cars.  Many like to test their skills in games like "Milk Bottle", "Balloon and Dart", and "Ring Toss".  One of the most well-know skill games is "High Striker", sometimes called "Ring the Bell" or "Strongman Game".  This game is commonly played by guys trying to impress girlfriends and wives with their macho strength.  In this game, a large mallet is used to strike one end of a lever.  The other end has a puck that reacts by rising up a tower.  If the lever is struck hard enough (and at exactly the right spot--dead center!), the puck will rise to the top of the tower and ring a bell.  The guy can then bask in the glow of his ego, while his better half walks away with a stuffed toy prize!

PocketLab/ScratchX High Striker

This PocketLab/ScratchX "High Striker" game can be played by anyone from 5 to 105.  No mallet is required--your forefinger is the striker, Pocketlab Voyager's tactile sensor serves as the lever, and ScratchX  rings the bell if you strike hard enough.  The force required to ring the bell can be easily adjusted for age and gender--thus allowing play by everyone!

See Figure 1 for the setup.  The tactile sensor is connected to Voyager and taped to the tabletop with removable double sided tape to keep it stationary.  The player's forefinger is the "mallet", and the black horizontal bar on the ScratchX stage is the "puck".  In this image the puck reached a height of  about 3/4 of that needed to win.  When the forefinger strikes hard enough for a win, stars flash and ScratchX beeps to indicate the win.

PocketLab/Voyager "High Striker" setup.
Figure 1

Action Video

A video that shows this ScratchX program in action can be found below.  The video shows the forefinger striking the tactile sensor several times, with a harder force each time.  When the force is high enough, a win is indicated by flashing stars and beeps.

The ScratchX Program

Figure 2 shows the ScratchX blocks for the horizontal black bar sprite of the "High Striker" program.  The group of blocks labeled "1" accomplishes four things. First, a message is broadcasted to the stars sprites to hide them.  Second, the user can set the minimum tactile pressure that rings the bell to the desired value (in Arbitrary Units--AU).  For small children, this value might be 10 or 15.  Next, the y position of the puck (the horizontal black line) is set so that it is at the bottom of the red tower.  Finally the initial y value for the puck is saved in a variable.

The first thing that happens within the forever loop is to get Voyager's tactile sensor pressure value (block 2).  The if-then-else block 3  then checks to see if the current tactile sensor reading is less than the tactile pressure required to ring the bell.  If so, the height of the puck on a 0 to 100 scale is set in block 4.  Since the height of the tower is 300 pixels, this value is then multiplied by 3 in block 5.  The initial y value is then added to obtain the new y value of the puck.  In the event that the tactile sensor value is greater than or equal to the tactile pressure to ring the bell, then a message is broadcast to the stars sprite to show the stars (block 6) for a win.

High Striker ScratchX Program
Figure 2

The ScratchX blocks for the star sprites are shown in Figure 3.  When the hideStars message is received, the sprite is simply hidden.  When the showStars message is received, upon pressing the forefinger with at least the threshold pressure to ring the bell, a repeat loop is executed 20 times.  Each time the stars sprite is shown, a pop sound is heard, and there is a 0.05 second pause.  After that the stars sprite is hidden again for 0.05 seconds. 

ScratchX blocks for the stars sprites
Figure 3

Help for Programming PocketLab in ScratchX

If you are not sure of how to proceed using the PocketLab ScratchX extension, don't hesitate to visit this link.

Setup for the Voyager/ScratchX "High Striker" game