+ 2

Collision test

Ok, I'm programming a platform game in Actionscript (flash) and I have a problem: Imagine your platform game character is falling, falling at a million pixels a frame; every frame, the code checks if your character is touching the ground, if it is, it stops falling, and if not, it keeps falling. Now think of this: your character is still falling a million pixels per frame, but, at one point, it is only ten pixels higher than the ground, which is 10 pixels thick. It will keep falling, right through the platform, even though we programmed it to stop falling when it hits a platform. Why is this? Since it is falling so quickly, it skips through the platform. How do we fix this? Well, an obvious solution would be to make the platforms thicker, or make your character fall more slowly, but say you don't want either. Let me just save this first. I came up with this: https://code.sololearn.com/c5Y6XDP65CG4/?ref=app

30th Oct 2018, 12:39 PM
Theprogrammers
Theprogrammers - avatar
1 Respuesta
+ 3
You can check if two objects are touching, or if an object is touching a point.
31st Oct 2018, 12:30 PM
Theprogrammers
Theprogrammers - avatar