Right now I have my platform movement just about perfectly the way I want it, but except one thing. Say I have a buttom platform which supports the player. Now you jump, he goes up then gravity kicks in and he comes back down, but sometimes His feet will go a little below the platform, but not all the way through. Right now my events for gravity are: (Dont steal)
Always + Gravity Of < 10 = add 1 to Gravity(player)
Always > "Set Y(Foot Detector) + Gravity(player)"
Always + (Foot Detector)is overlapping a backdrop) > Set Gravity (Player) to 0
Thats basically my gravity. All its doing is if he isnt on a platform it adds 1 to his gravity if the gravity isnt more than 10. I just need it so that his feet dont go into platforms. I know the problem is that its setting his Y position Up too much, but If I lower the gravity strength, he falls really slow.
Run a fast loop so that the character only moves 1 pixel down per loop.
The number of loops to run is the strength of the gravity. Make sure you put the collision event inside a loop also, or it will active after the loop has occured, similar to what is happening now.
Another little tip: two of the "always" events are useless in your current system.
I fixed it a different way: I added a second sensor. It is a little below the first "foot sensor". When it is overlapping a backdrop it slows the gravity down (so that he doesn't come down more than 4 pixels at a time). So if he's coming down by say 10 pixels at a time you'd probably want it about 10 pixels down from the first sensor. This way he doesn't come down too slow because it only decreases the gravity when he's close to the ground so it's not noticable. Make sense?
Indeed, I will try both, and I didn't realize those always events being useless at the time. Thanks!
EDIT : It works a little better, sometimes he doesn't go through. Here is what I have:
Always > Start Loop "grav" 10 times
Player is not overlapping a backdrop > Set Gravity(Player) to 1
On Loop "grav" > Set Y(Player) to Y(player) + Gravity(Player) /which is one/
So he is going down one pixel on each gravity loop which always loops 10 times. Is this what you wanted me to do?
No, that means he will always fall at 10. You want it like this...
Player not overlapping backdrop + gravity < 10 = add 1 to gravity
gravity > 0 = start loop(fall) gravity times
on loop(fall) = set y postition of player + 1
on loop(fall) + player overlapping backdrop = stop loop(fall) + set gravity to 0
To give an actual example (and not to hijack the thread, honest) can anyone tell me what immensely obvious thing I'm doing wrong here? Because I've no idea. The player still sticks down into the platform, and I'm sure that event #14 should work to prevent that.
Yes, you have to make sure you put an event to updates the sensors directly before any event which tests their location, or it will act as if the object hasn't moved.
"Well I managed to get my guy to barely stick in the ground. He only goes in about 1 pixel"
It may depend on your order of events. I always put my detectors 1 pixel from the edge of my sprite, not on the edge of the sprite, but it all depends how you've set up your movement.