Computer Science Canada Angled Collision Issues |
Author: | DemonZ [ Tue Nov 21, 2006 1:14 am ] |
Post subject: | Angled Collision Issues |
Ok I am working on my 1 player part of my program, which is the user commanding a tank while enemy tanks try to cross to the bottom side of the screen, now I got all of that working exceptionally well, but the collision seems faulty nd I dont understand why, im using the correct formula, but for some reason it calculates the space in which the collision happens somewhere else, making the tank shells go through the enemy tanks sometimes without destroying them, so far im only concerned with the collision and another issue, and the other issue seems simple but not, there is a boolean variable that I have called 'player1ishooting' which is true if the fire button is pressed, and will go false if it is not, my problem: once the bullet has been fired, after it reaches a certain distance, the boolean will turn false and the bullet will die out or disappear, but, if you hold the fire button continously, after the bullet hits a tank in the collsion area (if it does even) it will calculate the damage and the tank will disappear, but the bullet will continue to travel even after the bullet hit the tank causing a collision and the variable that checks if firing or not, is switched to false. If anyone can help me resolve these issues (I think I might know what is causing the firing problem) it would be a huge help. Here is the file, the controls are arrow keys to move and NUM 0 or insert to fire. |
Author: | DemonZ [ Wed Nov 22, 2006 11:50 pm ] |
Post subject: | |
sorry never mind I strangly found the solution to my problem, what a waste.... ![]() ![]() |
Author: | NikG [ Thu Nov 23, 2006 11:53 am ] |
Post subject: | |
Why not let everyone know how you solved this in case anyone ever has the same issue? |
Author: | DemonZ [ Thu Nov 23, 2006 8:26 pm ] | ||||
Post subject: | |||||
ok for people who are curious to know because im sure there are people who were having problems with this before or may be experiencing it, this is my solution to correct myself. What happened is that my enemyx2 was not updating, therefore could not accumulate collision, so I changed enemyx2 into a new value
this way the enemyx2 and enemyy2 will constantly update with enemyx and enemyy, then I changed the collision detection to something like this.
so now im using rectangular collision detection for the tanks which constantly update their coordinates, making the collision very accurate. I think the next time I run into a problem ill do what my teacher says "Research and EXPERIMENT!" sorry for making a seemingly wasteful topic to discuss everybody. |