Discuss Scratch

ti2v78
New to Scratch
8 posts

vertical scrolling platformer - issue with sometimes falling through a platform

I have a scrolling vertical platformer using clones to create the descending platforms to jump between. I have managed to get the jump to land “on” a platform - and not simply when “touching” the platform.

The way I do this is to sense both sides:
- is my sprite touching the platform sprite
- is the platform sprite touching my sprite

In doing this, I set variables:
Platform X, Platform Y to know the “center” of a cloned platform and can then do some additional views of “me” to see if I am just touching or actually “on” (relative to Platform Y).

However, if for some reason I touch two platforms too close together, I don't sense the second one if I fall to it and end up simply falling through it.

I assume this is because by the time I touch the bottom platform, I still have the X/Y from the previous touched platform … but it should have been reset as I fell to/through the one below.

My code uses a .01 wait between “touches” - which should be easily fast enough to sense the second platform.

This isn't a common thing (I space the platforms out to avoid this), but bothers me that I have not been able to completely get rid of it. Any suggestions or thoughts?

Project for reference:
https://scratch.mit.edu/projects/570003225/

Powered by DjangoBB