Jumping through platform but landing on it.
austinlee
Member Posts: 19
Can anyone suggest a way to create a platform that you can jump to from below but then land on the top?
Comments
actually, i think FireMapleGames is the one to talk about this I know he's got it working in his platformer template.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Mulcahy and tshirtbooth are right in that FireMapleGames will probably have a slick solution.
You could keep track the linear Y velocity of the player with a global attribute and a Constrain, like this:
Constrain Attribute
game.PlayersLinearY = self.Motion.Linear.Y
Then, in the Cloud Platform, only collide if the player is moving in the down direction, like this:
Rule
When game.PlayersLinearY <= 0
Collide with Actors of Type Player
Another way is similar, but you would keep track of the Player's Y position
Rule
When game.PlayerY > self.Position.Y
Collide with Actors of Type Player
In both cases, you might also want to keep track of the Player's X Position as well, so you only collide when the player's X falls within the bounds of the platform, otherwise funky things might happen when you collide with the side of the platform. (funky things will probably happen regardless!)
Anyway, that's the basic logic.
Your demo was very helpful to me. My problem now is that my "guy" is kind of a tall looking character and when his head hits a platform it allows him to jump up through it. Obviously we want him to only be able to jump when his feet land on the platform. Any ides?
Blade
OR (This is actually what I did, but I almost forgot!)
Create a very short actor with the same width as the actor that you are currently using. Put all of your jump rules in this very short actor and constrain the current jumper to this actor's X and Y with an offset in the Y (probably around half the tall jumper's height). Yeah, do this it works way better!