Legacy GM Could someone suggest how I would go about writing a better collision system please?

T

Temmy

Guest
Hey folks,

At the moment, I'm using the standard drag and drop collision event that GS supplies however this isn't really as accurate, precise, or as fast as I require.

You can see the problem here: https://drive.google.com/open?id=0B0O-TT1RwibRVGNQQl9LQjdKWjQ

As the arrow bounces around, you'll notice that it eventually stops but instead of stopping when touching the wall it will leave a gap. This varies from shot to shot.

Would anyone be so kind as to teach me how a better collision system might be made? I imagine something that can check a pixel ahead to know if a wall is about to met would be a better solution. The difficulty I'm having is that here we're potentially talking varying angles and vectors - not just as simple as moving left / right as a platformer might be coded (and those are the only tutorials I can find).

Thanks.
 
T

Temmy

Guest
This will show you pixel perfect collsions
Thanks for the reply. As I mentioned though, my suspicion is that this isn't as simple as just checking for x+1 / y+1 as the projectile doesn't move as predictably as a platformer character. It can hit a wall at varying angles and rotations.

Do you think that changes anything?
 

Bingdom

Googledom
Tip:
Instead of setting hspeed to 0, you just invert it.

It doesn't check x+1/-1 y+1/-1. It checks where it would go to in the next step. If there is a collision, it will move up by 1 pixel until it detects a collision. It's quite precise and runs well. ;) It realistically might change the coordinate a bit after the bounce, so you may have to make up for it after the bounce.
 
Top