CSCE 101 Lab 4 – Mushroom Picker

MoleMash variant

Academic Honesty

·  The work you turn in is to be your work, not copied from someone else, from the web, or generated by a program.

·  Never allow anyone access to your files.

·  Never give anyone your password.

·  Never share your USB memory or email your files to anyone else.

·  Never give anyone a printed copy of your file or an electronic copy.

·  Never allow anyone to copy your work.

Problem Statement

You will save the completed assignment in your 101Labs folder on your X: drive (X:\101Labs\).

It is important that you name your files exactly the name given. This is what is looked for during grading.

Tutorial Section (Pre-Lab)

1.  You are going to follow the instructions for the MoleMash tutorial with three changes:

  1. Important: When starting your project, do not do the Tutorial in Screen1. Create a Screen1 for Lab5 like you did for Screen1 in lab 4 -- which has buttons you can click to get to either the Fahrenheit or Grade Calculators for each of the the separate Calculator screens. Do the Molemash Tutorial in a separate screen (name it "MoleScreen" or something similar). Just make sure Screen1 has:
  2. A short message, including your name
  3. A button that will take you to the Molemash screen and the code in Blocks Editor to actually do it.
  4. You can wait to add a button for the final part of lab 5.
  5. Name your file “Lab5_XY”, where ‘X’ and ‘Y’ are your initials.
  6. Change the TimerInterval property to 1000 to start with, not 500.
  7. You don't need to do any variations.

2.  App Inventor site: http://appinventor.mit.edu/.

3.  MoleMash direct link: http://explore.appinventor.mit.edu/ai2/molemash

In Class Portion (due night before next lab)

This game will be like MoleMash except that every time the mushroom pops up it should be one of two mushrooms -- one poison, one beneficial.

The idea for this game is that there the clock is running down and the player must keep hitting the good (not purple poison) mushroom. The game plays like MoleMash exept:

·  The game should get progressively harder while the player avoids running out of life. The speed of the game increases everytime the player gets a good mushroom.

·  Every time the clock fires the players life should go down 1.

·  The Life (formerly score) should start at 30.

·  If the player hits the purple mushroom their life should go down by 5.

·  Every time the player hits the mushroom the life should go up by three but the TimerInterval (which should start at 1000) should be multiplied by 0.95 and stored back (you’ll need a get to get the old interval and a set to store the result of the multiply).

·  Since this is a significant modification of Molemash, but still a modification, it may be a good idea to keep the final code up from the tutorial when you’re doing this: MoleMash (scroll to the bottom).

  1. Create another screen in the app you made for the pre-lab; name it something “mushroomy” (since this is a mushroom game).
  2. In that screen load these images:
  3. https://drive.google.com/file/d/0B9sKadoJpcULeFBQb3N1RWlRNFU/view?usp=sharing[1]
  4. https://drive.google.com/file/d/0B9sKadoJpcULd3VCdE5Ic1RTVkk/view?usp=sharing[2]
  5. Add the Canvas, Reset Button, and an ImageSprite (rename to Mush). Set the ImageSprite's width and height to 40-by-40.
  6. Create another Screen, called “MushGameOver” or something similar and load this image into it: https://drive.google.com/file/d/0B9sKadoJpcULZ01ObFY4Q1p6Zjg/view?usp=sharing[3]
  7. Drag out an Image component in Designer and set its:
  8. Picture to gameoverthumb.jpg
  9. width and height to 300 pixels
  10. Add a “Back to Start” button that will take you back to Screen1.
  11. Go back to the Mushroom Game Screen
  12. You need to recreate MoleMash except with these changes:
  13. It would make sense to name everything “Mushroom” or “Mush” instead of “Mole”, obviously (the ImageSprite and the Clock, in particular, but also the procedure names).
  14. “Score” should now be “Life” as well.
  15. Every time the clock's timer fires do the same stuff as in MoleMash except
  16. the life total should go down by one (1), which didn’t happen in MoleMash
  17. call UpdateLife (formerly UpdateScore)
  18. You also need to see if the game is over. The game is over when the player’s life is less than 1. Here’s the code for the if you will need:
  19. If the game is over than you need to go to the GameOver screen. Note that sometimes the emulator won't show the image when you change screens.
  20. In the MoveMush (not "MoveMole") code, in addition to choosing a random location, change the picture randomly using the Mushroom imageSprite’s Picture property and setting its value by using the pick a random item and a make a list, like in lab 3. The values should be text blocks (“ ... ”) with the values:
  21. “PoisonMushroom.gif”
  22. “Mushroomy987.png” (note the different file extensions)
  23. When the ImageSprite is touched, you need to use 2 ifs or a single if/else, which can be found in the Control drawer. The code to see if the Moles current picture is the poison mushroom is :

The hot pink blocks are from the Text Drawer.

a.  If the poison mushroom is hit, then reduce life by 5

b.  If the good mushroom is hit then:

  1. life goes up by 3
  2. the game should speed up, i.e.:

set MushClock.TimerInterval to MushClock.TimerInterval × 0.95.

c.  For both a and b, call UpdateLife and then call MoveMush

  1. The reset button should reset the life to 20 (not to 0, since that wouldn't be very fun).

Submitting Your Code (Generic Instructions)

a.  ​Open "My Projects" in upper right of the App Inventor Webpage

b.  Put a check next to the project you want to download (you can only download one at a time). Download the modified version, if you have multiple copies.

c.  Project->"Export selected project (.aia) to my computer"

d.  The file will download so go, in Chrome, to the download location by clicking thearrow next to the file nameat the bottom of the screen and selecting "Show in folder".

e.  Move the ______.aia file to your X:\101Labs directory for grading.

f.  Important: make sure you have only letters and numbers in the file name -- there should not be a " (1).aia" at the end. Right Click, Rename the file to get rid of the space, number, and parentheses. If you haven't already, you must add your initials to the end of the file name, before the ".aia" extension. Your lab instructor may deduct 5 points if you fail to do either of these steps.

Got time left? (Pre-Lab for next time)

Your lab instructor should have the lab6 pre-lab linked off of their webpage. You may begin the Pre-lab or just read it ahead of time.

[1] http://mushroomy987.deviantart.com/art/Mushroom-Sprites-160586131 (CC license)

[2] http://blog.jonnay.net/plugin/tag/mario (CC license)

[3] http://www.spritestitch.com/game-over-mushroom-pattern/ (CC license)