Inf-Devs / procyon_skies

A game server, just like one of the .io games. Enjoy blasting each other.
1 stars 1 forks source link

Glancing blows by missile? #12

Closed laifrank2002 closed 5 years ago

laifrank2002 commented 5 years ago

If you hit an asteroid just right, the asteroid moves slightly, but the missile continues on as if nothing has happened.

Clocks-in-a-Cooler commented 5 years ago

Probably a server issue, or maybe the missile's radius is too small. It's drawn more than twice as large as it actually is. Maybe I'll change that.

laifrank2002 commented 5 years ago

Either my eyes aren't right or there's a server bug; That would just cause the missile to glide pass harmlessly. It's the changing the angle of the asteroid that I'm concerned about.

Clocks-in-a-Cooler commented 5 years ago

So, to clarify, the bug is that the torpedo is affecting the asteroid, but the asteroid is not affecting the torpedo?

laifrank2002 commented 5 years ago

Yes. I'm guessing that whichever one of these is responsible for doing collisions is working, but the check for explody is not. Try looking into the torpedo object.

Clocks-in-a-Cooler commented 5 years ago

Each projectile (blaster bullets, torpedos, sonic cannon bubbles, etc) has a collision() method. Usually, this deactivates the projectile and returns its damage.

But... Projectiles (with the exception of the sonic cannon bubble) are also bodies. I'm guessing that the asteroid checked for collision detection with the torpedo as a body first. This means that the asteroid moved out of the way. When it checks for collision detection with the torpedo as a projectile, since it already moved out of the way, it does not register as a hit.

I've redone the collision detection. Now, asteroids don't move out of the way when it gets it. Instead, only its vector is updated. This should fix the problem.