I need another difficult script that stops a sprite from falling partially into the ground sprite. You know how that happens when you add gravity to a game but it always stops when it's half buried in the sprite. I want to know a way to stop the sprite exactly on top of the sprite. Is there a good of doing this?
Offline
bullelk12 wrote:
I need another difficult script that stops a sprite from falling partially into the ground sprite. You know how that happens when you add gravity to a game but it always stops when it's half buried in the sprite. I want to know a way to stop the sprite exactly on top of the sprite. Is there a good of doing this?
The only really good way of doing this is stopping the sprite and slowly moving it up until there's on a pixel of contact. This can be done by forcing a loop-like action in a sprite:
if <touching [ground v]?> change y by (1) set [yvel v] to (0) if <touching [ground v]?> change y by (1) else change y by (-1) end if <touching [ground v]?> change y by (1) else change y by (-1) end if <touching [ground v]?> change y by (1) else change y by (-1) end if <touching [ground v]?> change y by (1) else change y by (-1) end if <touching [ground v]?> change y by (1) else change y by (-1) end endand so on. That's the basic idea.
Offline
when gf pressed forever if <touching [ground v]?> change y by ((0) - (yvel)) set [yvel v] to ((yvel) / (3)) change y by (yvel) if <touching [ground v]?> change y by ((0) - (yvel)) set [yvel v] to ((yvel) / (3)) change y by (yvel) if <touching [ground v]?> change y by ((0) - (yvel)) set [yvel v] to ((yvel) / (3)) end end end endThis script is not mine, it's eRKSToCK's, but I use it often and it works.
AtomicBawm3 wrote:
The only really good way of doing this is stopping the sprite and slowly moving it up until there's on a pixel of contact. This can be done by forcing a loop-like action in a sprite:
There are actually quite a lot of scripts you can possibly use for platforms.
Offline