Timeline for Checking if bullet collides with enemy when I know the start X & Y, the angle, the speed and dist traveled of the bullets
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 3, 2017 at 18:02 | vote | accept | JohnT | ||
May 3, 2017 at 18:02 | comment | added | JohnT | I managed to get the basic solution working | |
May 1, 2017 at 19:17 | comment | added | Victor T. |
Try printing out some other reports to the console log, between the different places where continue is used. If you can find out which of those tests is causing the collision to fail, it will be easier to figure out what's wrong. If you want to pastebin your code and let me know where the loop continuing, I'll be happy to take another look.
|
|
May 1, 2017 at 18:18 | comment | added | JohnT | I've added the parenthesis and still can't get it to work, anything else you can suggest? | |
May 1, 2017 at 17:57 | comment | added | Victor T. |
You need to put parentheses around the playerArr[i].bullets[j].traveled-10 . Right now, the math is "divide 10 by traveled, then subtract that from traveled". It needs to be "subtract 10 from traveled, then divide the result by traveled".
|
|
May 1, 2017 at 17:45 | comment | added | JohnT | I appreciate the long answer but I just can't get this to work. This is how I've tried to do it pastebin. I set bullettraveledPrev to traveled -10 because that's what the previous value would of been (sorry if I misunderstood) | |
May 1, 2017 at 16:57 | history | answered | Victor T. | CC BY-SA 3.0 |