Unlike Programs 1-5, this assignment will specify what to code. You will start with the posted FlyGame Download FlyGamep

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Unlike Programs 1-5, this assignment will specify what to code. You will start with the posted FlyGame Download FlyGamep

Post by answerhappygod »

Unlike Programs 1-5, this assignment will specify what to code.You will start with the posted FlyGame Download FlyGameprogram andmodify it to define and use various new functions, as specifiedbelow. Set the Code12 Java Language Syntax Level to 9, downloadFlyGame Download FlyGame, extract the zip into a folder, and renamethe folder to your last name plus FlyGame9 (for example "ManoFlyGame9"). Then make the changes below and submit a zip of yourfolder when you are done. Changes You Need to Make 1. The code toreset the fly for another pass (behavior #10), which is 2 lines ofcode, appears twice in the program. Define a new function namedresetFly(), move this code into this function, and call thefunction from the two places needed in update(). 2. The code toupdate the scoreText text object based on the current value ofscore is only one line of code, but it appears twice and would bebetter in its own function. Define a new function namedupdateScore() to contain this code and call it from the two placesin update(). 3. To help break up the long update() function: Movethe code for behaviors #1, #2, and #3 into a new function namedmoveBird(). Move the code for behavior #5 into a new function namedcheckFly(). Move the code for behaviors #7 and #9 into a newfunction named checkDrone(). Move the code for behavior #8 into anew function named checkForHit(). 4. Behavior #12 includes a checkto make sure the score doesn't go negative. Take this out andinstead add logic to function updateScore() to make sure the scoredoesn't go negative. Note that updateScore() is called both whenadding a point and when subtracting a point, so it needs to work inboth cases for the score to work properly. 5. Write a commentbefore each function you have defined that describes what it does.6. Make sure all the code you moved is indented properly accordingto the normal style. Code inside a function should be intended onetab past the function definition and opening {. 7. Add behavior #13(see comment at top of file). Give some thought to where in thecode you should put it. 8. Make the fly speed 1.2 so it can't hidein the drone for a whole pass.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply