1. MoleMash has an event that doesn't really fit into the category of user-initiated event or external event. What is it?
- screen.initialize (app starts)
- clock.timer (timer event: triggered every time interval)
2. The animation in MoleMash occurs in a Canvas component.
a. What function blocks can you use to move an image sprite within the canvas? What are the function's parameters? In this case, the "x" and "y" values are the formal parameters and the blocks that are connected to it, like "random integer" are the actual parameters.
A parameter of a function is the information that a function needs to do its job.
b. How do you refer to the vertical and horizontal location of an image sprite within the canvas?
Image.y and Image.x.
c. What is the unit of measurement for location on the canvas?
A pixel: the smallest dot on a computer screen.
d. How can your app find out the width or length of the device's screen?
Your app can find the width or length of a device's screen using these parameters:
e. How is color defined in App Inventor? How is it defined in HTML?
There are 16 colors already defined in App Inventor. In HTML, it uses a hexidecimal system (using the baseline 16) consisting of numbers which translate to RGB values.
3. The MoleMash tutorial has you define two procedures.
a. Name the one procedure.
MoveBobaFett: move ImageSprite to random location.
b. Could you write the MoleMash app without defining these procedures?
c. What is the purpose of defining a procedure, in general?
- Named sequence of blocks
- User doesn't need multiple copies of blocks
- Give a name to some complex details (abstraction--lets users ignore details at times)
4. Sketch the blocks to increment (add a point to) the score in MoleMash. How would you subtract?
The HitCountsLabel keeps track of how often you hit the ImageSprite (which in this case is BobaFett) and how often you hit the canvas instead. That goes toward the MissesCountLabel.
To subtract, a user would substitute the "+" to "-" in the MissesCountsLabel which subtract points.
5. When a row of blocks is performed, in what order are they performed?
When a row of blocks is performed, it moves from right to left, basically. In reality, the inner blocks are done first. You have to set x = x + 1.
Why does MoleMash have both a global variable score and a label
ScoreLabel? Could you have written MoleMash with just ScoreLabel and not
the variable score?
MoleMash has both a global variable score and a label ScoreLabel because the label is what appears on the screen and the global variable score is what keeps track of the score in the game. No, MoleMash could not have been written without a variable score because then there would be no way to keep track of the score.
7. a. How could you modify MoleMash to make the mole move faster?
The user would change the ClockTimerInterval property. The Timer event will trigger during specified intervals that are programmed in the TimeInterval setting. b. How could you modify MoleMash so that the user can change the speed of the mole?
Add buttons or a textbox and button that allow the user to change the ClockTimerInterval property.