Lab 8: MoleMash

Description

This is the eighth lab of emt 1111, and what this lab will be about is actually introducing animation to app inventor well in this lab MoleMash we will be designing a game basically playing with a mole except we are using app inventor to do this lab. Unlike python were we would use commands to produce a solution here we have to use blocks or event handlers to figure out the lab well. In this case we use canvas, sound tool, button tool, labels tool because its more than 1 and also a clock to put how long we want to vibrate the mole when we touch it and we also have to label these things that we insert to the screen editor so we wont get confused. And also another concept that differs this lab to the previous two is that we are relying on canvas to place the imagesprite in a certain position of the screen by using the canvas coordinating system and if we dont use it during this lab it can be a key loss in the lab. Below ill show you my interpretation of the code that i made to solve this lab and towards the bottom i will show you both the blocks editor screenshot and the screen editor.

Code

Here ill explain the code first of all i followed step by step guidlines from the chapter that corresponded the lab, first i went to build in-definitions and found movemole block and added that first and after that i add the block move to from mole inside the move mole block next i added two blocks of random integer from math panel, after you remove number 100 from both blocks and instead add a subtracting block to it and place linewidth blocks from canvas to it followed by the mole’s width and height. Then i added the canvas touched block , i added the if else inside the touched block with set hits and misses labels to it, then i added two adding blocks from math to the touched block adding it to number 1. Almost there, next you add the mole.touched from the mole panel then you must add the sound block “vibrate” to it so when you touch the mole when you play with it it will vibrate but you must set it to milliseconds in which i set it to 100 =1000. To replay the mole game you must add the reset block by adding the hits and misses labels inside the reset button block so it will work. After that you add the clock block, you put the movemole variable inside it so the clock will time how long the vibration when you tap the mole. Finally you add the screen 1 initialize block and again you add the movemole variable to it and now im finished explaining the program or code of molemash lab. This makes sense only if you look at the “SCREENSHOTS” below if you see the screenshot then you will comprehend what i explained as mentioned above.

main=appinventor.ai_pineroskevin.molemash.Screen1
name=molemash
assets=../assets
source=../src
build=../build
versioncode=1
versionname=1.0
useslocation=False
#|
$JSON
{"YaVersion":"75","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"10","Uuid":"0","Title":"Screen1","$Components":[{"$Name":"Canvas1","$Type":"Canvas","$Version":"7","Uuid":"-1882842918","Width":"-2","Height":"300","$Components":[{"$Name":"Mole","$Type":"ImageSprite","$Version":"6","Uuid":"-1329052418","Picture":"mole.png","X":"0","Y":"0","Width":"36","Height":"42"}]},{"$Name":"ResetButton","$Type":"Button","$Version":"5","Uuid":"-620618254","Text":"Reset"},{"$Name":"HorizontalArrangement1","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-702386983","$Components":[{"$Name":"HitsLabel","$Type":"Label","$Version":"2","Uuid":"305240742","Text":"Hits"},{"$Name":"HitsCountLabel","$Type":"Label","$Version":"2","Uuid":"-702802355","Text":"0"}]},{"$Name":"HorizontalArrangement2","$Type":"HorizontalArrangement","$Version":"2","Uuid":"-568725094","$Components":[{"$Name":"MissesLabel","$Type":"Label","$Version":"2","Uuid":"596594660","Text":"Misses"},{"$Name":"MissesCountLabel","$Type":"Label","$Version":"2","Uuid":"1264033280","Text":"0"}]},{"$Name":"Clock1","$Type":"Clock","$Version":"1","Uuid":"-1072118762"},{"$Name":"Sound1","$Type":"Sound","$Version":"3","Uuid":"509265613"}]}}
|#

 

 

Screenshot

Here are the two screenshots that i created for this lab the following is the screen editor screenshot and the blocks editor screenshot that i did. The one in the left is the screen editor and the screenshot in the right is the blocks editor screenshot, By showing these two screenshots that i made i figured out how to create the animation game molemash by using knowledge of app inventor, and by showing the two screenshots ive completed the lab molemash lab.

lab 8 2 lab 8

Leave a Reply

Your email address will not be published. Required fields are marked *