Gonster!!! Scan for Monsters in the Kid's Room

by TimV43 in Circuits > Gadgets

798 Views, 5 Favorites, 0 Comments

Gonster!!! Scan for Monsters in the Kid's Room

Gonster!!! Scan for monsters in the kid's room
Screenshot_2017-03-13-14-05-41.png
Screenshot_2017-03-11-20-51-27.png

This project was inspired by the Monster-B-Gone project that appeared in Make magazine last summer. That was a hardware project utilizing a Trinket microcontroller and a NeoPixel ring. My version is a software project using Pocket Code and a smart phone. A quick search confirmed that there are already monster scanner type apps available for download, but I haven't tried any of them. I hope, like me, you'll find it more fun and interesting to make your own.

Pocket Code is from Catrobat:

Catrobat --- http://www.catrobat.org/ and http://www.catrobat.org/ --- is an independent non-profit project creating free open source software (FOSS) under AGPL and CC-BY-SA licenses. The growing international Catrobat team is entirely composed of volunteers.

and:

Pocket Code allows you to create, play, share, and remix Catrobat programs in a visual, "LEGO-style" programming environment. You can develop your own games, animations, interactive music videos, and many kind of other apps, directly on your phone or tablet. You can remix programs of others and share them with your friends and the world. With Pocket Code you can up- and download Catrobat programs through the Pocket Code community website at www.pocketcode.org.

You can view or download this project at https://share.catrob.at/pocketcode/program/26451.

To make your own you'll need an Android smart phone or tablet and you need to install Pocket Code and the companion Pocket Paint from Google Play. (I believe an iOS version is still under development.)

If you've never done any coding/scripting/programming before you should look at some of the examples and tutorials available online. But Pocket Code has a fairly easy-to-use drag-and-drop interface and this is a relatively simple project.

Background

Screenshot_2017-03-12-16-45-03.png
Screenshot_2017-03-13-17-04-39.png
Screenshot_2017-03-13-17-02-23.png
Screenshot_2017-03-13-17-02-36.png

This Instructable is not a tutorial on how to use Pocket Code. (There are some good tutorials available online in other places for that. Try https://share.catrob.at/pocketcode/help for example.) I am sharing the code and resources I used in this project so that you can replicate/modify/improve it.

  • Scripts
    • When program starts
    • show
  • Backgrounds
    • One background image that I named main_scrn
      • Created in Pocket Paint. It has a solid (red) background, a black rectangle near the top for a "screen," and the program name at the bottom.
  • Sounds
    • No Sounds

Switch

Screenshot_2017-03-11-19-51-40.png
Screenshot_2017-03-11-19-52-54.png
Screenshot_2017-03-11-20-05-03.png
Screenshot_2017-03-11-20-05-13.png
Screenshot_2017-03-11-20-05-24.png
  • Scripts
    • When program starts
    • Set size to 200%
      • The required scaling may be different for your screen. See note in the last step about sizes and coordinates.
    • Place at X:0, Y:-650
      • The position may be different for your screen. See note in the last step about sizes and coordinates.
    • When Tapped
    • If look_name = 'switch-off' is true then
    • Next look
    • Start sound Fairydust
      • This sound is from the Media Library in the Electronic section
    • Wait 1 second
    • Speak 'ready to scan'
    • Broadcast scan_on
    • Else
    • Previous look
    • Speak 'shutting down'
    • Broadcast scan_off
    • End If
  • Looks
    • Switch-off
    • Switch-on
      • Both images are from the Media Library in the Game Design elements section.
  • Sounds
    • Fairydust
      • As explained above, this is from the Media Library in the electronics section.

Click_btn

Screenshot_2017-03-11-20-11-40.png
Screenshot_2017-03-11-20-12-41.png
  • Scripts
    • When program starts
    • Place at X:0, Y:-300*
    • Hide
    • When you receive scan_on
    • Show
    • When you receive scan_off
    • Hide
    • When tapped
    • Broadcast start_scan
  • Looks
    • click_btn
      • From the Media Library in the Game Design Elements section
  • Sounds
    • No sounds

Alien-1

Screenshot_2017-03-11-20-17-32.png
Screenshot_2017-03-11-20-17-39.png
Screenshot_2017-03-11-20-20-27.png
Screenshot_2017-03-11-20-28-31.png
Screenshot_2017-03-11-20-29-16.png
Screenshot_2017-03-11-20-29-34.png
  • Scripts
    • When program starts
    • Set size to 150%*
    • Place at X:0, Y:450*
    • Hide
    • When you receive start_scan
    • Set variable scan_time to 0
    • Repeat until "scan_time" > 6 is true
    • Show
    • Speak 'scanning'
    • Wait 1 second
    • Change variable scan_time by 1
    • Vibrate for 0.5 seconds
      • This function is dependant on the capabilities of your device. In my earlier versions I didn't use this at all. Oddly, when I uploaded the file and then tested the download to the same device I got a message that vibrating was not supported by my device and the instruction would be ignored. That's something I need to research if I keep it in.
    • Start sound DirtyWhir
      • From the Media Library in the Electronic section
    • Next look
    • Wait 1 second
    • End of loop
    • Hide
    • Broadcast stop_scan
  • Looks
    • Alien-1
    • Alien-2.1
    • Red Alien-1
    • Green Alien-1
    • Green duster-1
    • Purple Alien
    • Orange Alien
      • All images are from the Media Library in the #galaxygamejam section
  • Sounds
    • DirtyWhir

Clear_msg

Screenshot_2017-03-11-20-40-37.png
Screenshot_2017-03-11-20-40-45.png
  • Scripts
    • When program starts
    • Place at X:0, Y:500*
    • Hide
    • When you receive stop_scan
    • Show
    • Speak "All clear. There are no monsters here!"
    • Wait 5 seconds
    • Hide
    • When you receive scan_off
    • Hide
  • Looks
    • This is an image with only the text, "NO MONSTERS!!!"
      • I created this in Pocket Paint
  • Sounds
    • No sounds

Credit_msg

Screenshot_2017-03-11-20-50-45.png
Screenshot_2017-03-11-20-51-15.png
  • Scripts
    • When program starts
    • Place at X:0, Y:450*
    • Hide
    • When you receive scan_off
    • Show
    • When you receive scan_on
    • Hide
  • Looks
    • This is an image with only text, "Gonsters!!! by Tim VanSant"
      • I created this in Pocket Paint
  • Sounds
    • No sounds

Some Final Notes

*First a note about the sizes and coordinates. In Pocket Code the maximum screen coordinates depend on the screen resolution of the device on which a program was initially created. (The 0,0 coordinates are at the center of the screen.) If you download programs, their coordinate system will in general be different from programs you make on your own device. Pocket Code currently works on Android devices with screens up to 7 inches.

I made the first version of this project on a Google Nexus 7 tablet, but the version documented here was on a Samsung Galaxy S5 smartphone.

I know this code can be optimized a bit and some features added. I hope that if you give this a try you'll post links to your projects.

Here are some possible additional features:

  • I think the On/Off switch needs to be disabled during scans. If you press it now while a scan is running you get the shutdown and credit messages on top of the scan.
  • The flashlight could be turned on during scans.
  • A mute button could turn off (or lower the volume?) of sounds. That might be especially useful if one child is up while others are asleep.
  • The hardware project on which this is based has a variable that will randomly "find" a monster and destroy it. That might be a little too scary for really young kids, but it might be fun for ones a little older.
  • I just used images from the included Media Library or from Pocket Paint. There is huge potential for finding/creating other images and importing them.
  • I want to try a version that uses the camera for scans rather than just pulling up stock images. They've added face detection to the program, but I haven't tried it in anything yet. That has some fun possibilities.