I've never done this, but I'll bet the answer has something to do with "if jumper x is > or = to platform x, then collide with actor of type platform" or something like that.
off the top of my head, the easiest way would be to have a rule similar to what design219 said, but it realy depends on what type of game you are making. If you're a doodle jump type game, i think you'd want to track the player's coodinates and see when he is above the platform.
actually, i think FireMapleGames is the one to talk about this I know he's got it working in his platformer template.
You might also try spawning and destroying platform actors when colliding with the jumper. The first platform you can pass through, but the duplicate actor platform that is spawned you cannot. With some tweaking, something like that might also work.
Mulcahy and tshirtbooth are right in that FireMapleGames will probably have a slick solution.
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!)
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?
you could try putting the change jump to true behavior in a rule in each platform. Then have the rule check that the platform's Y position is > the jumper's Y position + 1/2 the jumper's height (just put that in as a constant). Not totally sure if this will work but, you could try it.
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!
Scitunes, one more question.... so I constaring the X and Y of the full size actor to the X an Y of the short actor, but can you explain precicely how to do this?
create two game attributes (integer or real should work) call one jumperX the other jumperY. In the short invisible actor have two constrain attribute behaviors and constrain game.jumperX to self.position.X and then constrain game.jumperY to self.position.Y. Then in the visible actor that just serves as the image have two constrain behaviors. Constrain self.position.X to game.jumperX and constrain self.positionY to game.jumperY + (1/2 the height of the image so that the bottom of the image lines up with the bottom of the invisible actor)
That's great. It seems to work and makes sense too. One strange phenomenon I am seeing is my player seems to sag down under the platforms as he jumps sometimes, It's like the platfoms seem like they are not totally solid. Is this something going wrong with the physics settings maybe? Sorry for all the questions, I am still learning. Having a ton of fun though!
Comments
actually, i think FireMapleGames is the one to talk about this
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!