Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP ME ADD A POINTS SYSTEM AS A ASTROID IS HIT TO THIS CODE AND 3 LIVES AS A PLAYER LOOSES Forces Gravity and

PLEASE HELP ME ADD A POINTS SYSTEM AS A ASTROID IS HIT TO THIS CODE AND 3 LIVES AS A PLAYER LOOSES

image text in transcribedimage text in transcribedimage text in transcribed

Forces Gravity and friction Collision detection Graded Assignment: Asteroid game clone () Reading: Asteroid game clene Sh Discussion Prompt: Asteroid game done 20min End of Topic In this assignment the goal is to complete an asteroids game clone complete with realistic movement, gravity and collision checks as in the image above. Start by downloading the template code attached. Please note: This is a graded assignment. This is a draft of the assignment made available before course work submission is open, only minor changes may occur. Where do I submit? Forces Steps to complete Gravity and friction Collision detection Step 1: In bulletSystem.js complete the function edges(i) by looping over the bullets array and for each bullet check if it Graded Assignment: Asteroid has left the screen. If it has, remove the specific bullet from the array. (Hint: Use splice!) to remove the bullet from the game clone array and think about how you splice from an array correctly]. Remember: If you want to call a function or use any variable that belongs to the class you'll need to prefix it with the word "this". So in this case it would be: (II) Reading; Asteroid game clene this.bullets.myFunction(); Sh Discussion Prompt: Asterold game Step 2 in spaceship.js update the interaction(l) function and fill out the missing information in order to simulate the done correct behavior in the system. When the left arrow is pressed the spaceship should move left, when the right arrow is 20min pressed it should move right and so on. Please note that the spaceship won't move untilyou have completed the next step too. End of Topic Step 3: In spaceship.js update the move[] function similarly to how the moveil function works in asteroidSystem. Make sure you limit the velocity vector to maxVelocity so that the spaceship does not accelerate too much. Notice how, unless we fire the rockets in the opposite direction, the spaceship will keep moving. There is no friction in empty space. Step 4: In sketch.js complete the isInside(j function that takes the location of two circles and their diameters and returns true if they overlap, false otherwise. You could check it works, by creating a dummy circle around the mouse and checking if isinside returns true. Step 5: In sketch.js complete the checkCollisions() function so that you check collisions between the spaceship and all asteroids. Hint: You'll need to loop over all the asteroids and use the ininsideil) function you just programmed. If it returns true then you'll call the gameOver(i) function. If you've done things right, if the spaceship is hit by an asteroid the game will end. Check before proceeding. Step 5: In sketch.js add more functionality to the checkCollisions() function to check if an asteroid has crashed onto earth. If you do things right then the game should end when that happens. Check before proceeding. Step 2 in sketch.js add more functionality to the checkCollisions() function to check if the spaceship has collided with Forces Gravity and friction Step 9: In spaceship.js complete the setNearEarth(j function. When the spaceship enters the earth's atmosphere it's affected by the earth's gravity. Create a "downwards-pointing" vector of strength 0.05 which pulls the spaceship Collision detection towards the earth. The atmosphere also introduces friction and the spaceship can't move forever like in empty space. It Graded Assignment: Asteroid will decelerate unless it fires its engines. Create a force called friction that's 30 times smaller than the velocity of the game clone spaceship, points the opposite direction to velocity and is then applied in the the opposite direction. () Reading; Asteroid game clone Step 10: In sketch. js add more functionality to the checkCollisions0i function to check if any of the bullets of the Sh spaceship have hit any asteroids. If they have, then call the destroy(l) function of the asteroid object, passing it the Discussion Prompt: Asteroid game index of the asteroid to destroy. done 20min Step 11: Implement two of the ideas for further develpment below. Points given to ambitious learners. End of Topic Ideas for further development: - Make the spaceship pretty by adding jets thrusters which activate from the opposite side of movernent just like on a real spaceship. - Keep score of how many asteroids you have hit. - Make the program get progressively harder by spawning asteroids more frequently as time goes by. - Make it your own by customising the look of the game imake sure you maintain same functionality or you might lose points during grading). Marking rubric - Step 1- [1 point]: edges(i) function is correct. - Step 2 - [1 point]: interaction0) function is correct. - Step 3 - [2 point]: Spaceship moves correctly. No friction in space and velocity limited by maxvelocity

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions