Discuss Scratch

DextronDoolittle
Scratcher
10 posts

Collision detection and resolution with a moving camera

https://scratch.mit.edu/projects/1029133518
Here's my best attempt. As you can see, it's incredibly laggy and broken.
Is there a better way to do collision detection and resolution with a moving camera? This has always been something I was never able to get right.
(I believe it would be easier if I could get the surface normal and push the player out of the wall like that, but getting the surface normal seems impossible)

Last edited by DextronDoolittle (May 29, 2024 13:26:02)

gamerboi903
Scratcher
5 posts

Collision detection and resolution with a moving camera

Let's start with the resolution. The resolution might due to the fact that the sprite is too big. To fix that, you can do something similar to what Griffpatch has done where you make multiple costumes, and each costume is a different part of the map for example, Getting Over it Scratch Edition.

Now for collision.

I'm not very good at Scratch so my collision code isn't the greatest but here's this:
whenclickedsetoldxtoxpositionsetoldytoypositionforeveriftouchingsprite?thengotox:oldxy:oldysetoldxtoxpositionsetoldytoyposition

Last edited by gamerboi903 (June 5, 2024 06:42:02)

Powered by DjangoBB