Question
inside the checkCollision() function i have to loop over the two objects since they are movable object to know if they are colliding or not
inside the checkCollision() function i have to loop over the two objects since they are movable object to know if they are colliding or not so if they are intersecting the gane will over esle the game still working normal. So please it is not working when i am looping to.check if the spaceShip intersect with the astroids the game should over
example: checkCollision() { for(var i =0; i < asteriods.length;i++) { if(isInside(spaceShip.locA, spaceShip.sizeA, astroids[i].locB, astroids[i].sizeB)) { gameOver(); } } }
but the checkCollision function is not working maybe i didn't put the parameters properly please assist
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started