The Temperature Converter
CSCE 101 Lab 4 Rival Smasher: MoleMash VariantAcademic HonestyThe 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 In this lab you will be creating an app with a start screen and three other screens, the first of which will contain the MoleMash game (as you ought to have completed in the pre-lab). The second and third screens will correspond to the RivalSmash game, with the first being the screen which contains the game, and the second being the “Game Over” screen.Part 1: Rival SmasherThis part is not required to be completed during your lab time. You will not have to take and submit any screenshots for this lab. The completed Lab 4 will be due on the date posted on your lab instructor’s webpage.In this portion, you will create the Rival Smasher game within your existing Lab4_XY (where “XY” are your initials) project. Make sure you are continuing to work in the project you have already created to complete the pre-lab.The Rival Smasher game will be similar to MoleMash with the following changes: There will be one ImageSprite on the Canvas (as before), but it will not have an image assigned to it in the Properties section in Designer view;The Score label will be renamed (and the text property changed) to Life;This life counter will begin at 30.The images that will be assigned to the ImageSprite will be of two team’s mascots (preferably rivals);The image assigned to the ImageSprite will be set and changed randomly within your Blocks code.Every time the ImageSprite is hit, and the image assigned to the sprite is of your preferred mascot, the life count will decrease by 5;Every time the ImageSprite is hit, and the image assigned to the sprite is of the rival mascot, the life count will increase by 3;When the life count falls below 0, you have lost the game;When the Reset button is clicked, the score will return to 30.You need to pick two professional soccer teams, preferably rivals. Pick one team as your preferred team (we will call them the good team). The other (rival) team is the bad team and will be the team that will increase our life count upon being “smashed” in Rival Smasher.Once you have picked your teams, perform a search online for an image of each team’s mascot. Save those images on your computer.The Layout:In your Lab4_XY project, create another screen by clicking the button. Name this screen “RivalSmash.”In the RivalSmash screen, upload the images of the mascots you saved in step 3.1900555225107500You can upload the images by clicking “Upload File …” in the Media pane in Designer view.In order to do complete step 7, you will need the same components you used in creating the user interface for MoleMash. These components are:Canvas, ImageSprite, Label, Button, and Clock (Timer)Now recreate the MoleMash user interface with the following changes:You do not need to incorporate a Sound componentThe ImageSprite should not have anything assigned to its Picture propertyThe ImageSprite’s height and width should be 40 pixels by 40 pixelsReplace instances of “Mole” in component names with “Mascot”Replace “Score” with “Life”Once you have recreated the MoleMash interface with the changes listed above, add another button below the Reset button. Name this button “BackButton” and change its Text property to “Go Back”Switch to Screen1 and add a button. This button will allow a user to navigate from the home page (Screen1) to the RivalSmash game. Modify the Text property of the button to reflect its purpose. The Coding:Make sure to start the emulator in order to test your project. (Connect->Emulator)Ensure that you are in Screen1, and open the Blocks view.Now you are to make each button open the correct screen by using the block found at Built-In->Control->open another screen The value you set should be just a text block ( ), which is the first block under Built-In->Text. Set its value to the name of the Screen you want to navigate to.Switch to MoleScreen. Ensure you are still in Blocks view.Right-click your “MoveMole” procedure and select “Add to Backpack.”Alternatively, you can drag this procedure into the backpack at the top right of the Viewer.Adding blocks to your Backpack allows you to reuse the blocks in other screens. This will be handy as most of your RivalSmash blocks code will be very similar to that of MoleMash.Add all the collections of blocks in your MoleMash screen to the backpack.Switch to RivalSmash. Ensure you are still in Blocks view.Open the backpack by clicking on the backpack icon at the top right of the Viewer. Drag each collection of blocks from the backpack and into the white space of your Viewer.You may notice some errors () appear on the blocks you have dragged into the RivalSmash Blocks Viewer. Don’t worry; they are likely only appearing because you are trying to access components which do not exist in RivalSmash. For example, in trying to “set Mole.X to …”, the error occurs because you don’t have an ImageSprite named “Mole” in this screen.In order to fix these errors, use the drop-down menus to select the appropriate components for the blocks to access. E.g., change “Mole” to “Mascot,” “ScoreLabel” to “LifeLabel,” etc.Remove any blocks that reference MoleMash components that do not have mirrored components in RivalSmash (the “Noise” Sound component is one such component)Make sure you did not drag out any duplicate collections of blocks! This may cause additional errors.Once your blocks code is free of errors, change the names of the procedures and global variable to reflect the changes made in your user interface. For example, “MoveMole” should be “MoveMascot” in RivalSmash; “score” should be “life”Program the “BackButton” to return the app to the home screen when clicked. You can do this by using the block found at RivalSmash -> BackButton -> when BackButton.Click do, then adding the Built-in -> Control -> close screen block in the empty space.We will add some code to the “when Timer.Timer” blocks collection.Since this game can be lost (when the Life score falls below 1), we want to be able to check for this and open the GameOver screen in the event that the player has lost. Implement this by using the “if-then” block found in Built-In -> Control.Once these blocks are in your “when Timer.Timer” event handler, add to the opening following the word “then.” The blocks you add ought to be able to open a new screen with the screen-name “GameOver”In the MoveMascot procedure, we would like to be able to change the picture assigned to the Mascot ImageSprite randomly. In order to change the Picture property of the ImageSprite, you should use the “set Mascot.Picture to ” block found in RivalSmash -> MyCanvas -> Mascot. In order to assign the picture randomly, use the “pick a random item list” and “make a list” blocks found in Built-in -> Lists.In the empty spaces of your “make a list” block, add text blocks which contain the full image file name of the images you uploaded to the project previously. A full image file name looks like this example: RivalMascot.jpg (note that the file extension (.jpg) is included)Change your “initialize global life to” block collection to initialize your global variable to 30 instead of 0. Make sure to alter the “when ResetButton.Click” block collection to reset the global life to 30. We will add some code to the “when Mascot.Touched” blocks collection.When the ImageSprite is touched, we want to be able to add or subtract points to our life score based upon which mascot was touched. Remember that if the rival mascot is touched, we add 3 points, and if the good mascot is touched, we subtract 5 points.49815759334500In order to determine whether to add or subtract points, we can use more if statements. Here, you have the option to use either 2 if-then blocks or one if-then-else block.An if-then-else block is made by pulling out an if-then block, clicking the dark blue settings icon at the top left of the block, and adding “else” below the “if” on the left, as shown:64770058420000In order to check which mascot was touched, we can see which mascot image was assigned to the Picture property. The following screenshot shows how to achieve this:“gamecock.jpg” is example text. Here, you should use the full image file name of your good mascot.“Bad Hit logic here” refers to what should happen when a bad hit occurs—a bad hit, in our case, is one that happens to the good mascot. Since the good mascot is hit, we should be deducting points from our life score.Use the “set global life to” block (found in Built-in -> Variables) to change the value of the global life for both bad hits and good hits.Make sure both UpdateLife and MoveMascot procedures are called after this if-then-else block.Part 2: Game Over ScreenWe will now add the Game Over screen to our app.Download the following image: Layout, continued:In Lab4_XY, add a new screen. Name the screen “GameOver”In Designer view, drag out an Image component.Set its Picture property to the skull-and-crossbones image you downloaded aboveSet its width and height to 300 pixels.Below the Image, add a button. Change the button’s Text property to “Back to Start”The Coding, continued:Make sure to start the emulator in order to test your project. (Connect->Emulator)Make sure you are still in the GameOver screen and open the Blocks view.Program the button to open Screen1 upon being clicked. Test your completed app! Play the game and ensure the correct things happen when the mascot is touched, and when life falls below 1.Submitting Your FileOpen "My Projects" in upper right of the App Inventor WebpagePut a check next to the project you want to download (you can only download one at a time). Download the modified version of your app, if you have multiple copies.Project->"Export selected project (.aia) to my computer"The file will download so go, in Chrome, to the download location by clicking the?arrow next to the file name?at the bottom of the screen and selecting "Show in folder".Move the _______________.aia file to your X:\101Labs directory for grading (or upload). ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- how does temperature affect photosynthesis
- temperature widget windows 10
- temperature and photosynthesis rate
- local time temperature phone number
- temperature and photosynthesis lab
- temperature photosynthesis experiment
- what temperature should urine specimens be
- why does temperature affect photosynthesis
- how temperature affects photosynthesis
- photosynthesis temperature graph
- optimal temperature for photosynthesis
- desktop temperature icon windows 10