Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years ago by Arturo

Hi!

Im working with some moving platforms and I find this problem always (even if the moving platform is not moving at all and is just a FIXED object)

I saw this problem in 3 thread but never been resolved:

http://impactjs.com/forums/help/moving-platforms

http://impactjs.com/forums/help/newbie-moving-platform-issues

http://impactjs.com/forums/help/entity-vel-y-not-0-on-one-way-platforms/page/1

The problem is that the player, once he is in the top of a moving plaform (or any other Fixed entity), he enter in the fall or jump status... not in the standing status anymore... even if the entity is not moving. Checking the debug, the vel.y is never 0 when he is on the top of the fixed entity.

This is problematic becuase I cant make the player jump like it supose to, if he is on the top of this fixed entity.

ps: another question speaking about platforms. Is it possible to make a platform that you can go in on direction like the tiles on weltmeister?, but also work like a moving platform? Thanks.

8 years ago by Joncom

The problem is that the player, once he is in the top of a moving plaform (or any other Fixed entity), he enter in the fall or jump status... not in the standing status anymore... even if the entity is not moving. Checking the debug, the vel.y is never 0 when he is on the top of the fixed entity.
It is possible for the player to have a non-zero vel.y and still be standing on another entity such as a moving platform.

I believe the player must be "weaker" than the platform though. For example, I have a FIXED platform entity and a PASSIVE player entity, and my player can jump (because .standing is true) while on the platform.

Is it possible to make a platform that you can go in on direction like the tiles on weltmeister?, but also work like a moving platform?
Might be slightly tricky, but one-way collision is certainly possible. You'd likely need to modify the ig.Entity.solveCollision found in "entity.js" to account for position and vertical velocity when solving such a collision.

8 years ago by Arturo

It is possible for the player to have a non-zero vel.y and still be standing on another entity such as a moving platform.


The thing is, why the player should have a non-zero vel.y? he is still in the platform, and the platform is moving from left to right (well, even if is not moving the player have still non-zero vel.y).
The reason why is in animation fall is because I say so in update (I check the vel.y to know that) but becuase this have this extra 20 on vel.y, it will never be the status .standing, so it will never jump.

I believe the player must be "weaker" than the platform though. For example, I have a FIXED platform entity and a PASSIVE player entity, and my player can jump (because .standing is true) while on the platform.


I have the same thing. My player is PASSIVE, but I can only jump when the .standing is true, which is not because .... well I thought is because it has vel.y non-zero.

Do I have to make the player .standing=true when is touching the platform? seems too complicated for something that seems simple :S

btw: thanks for your help again Joncom ;)




EDIT
I've been testing around I think I figure out the problem.
If I ask the player for this .standing on this update function, and the player think that he is falling because the mover platform havent been proccess at this point. So If I set the code that set the anim for falling, and the code of the key press that make the player jump, on the update from main, then everything seems to works fine :)

if (ig.input.pressed("jump") && ig.game.player.standing) {
ig.game.player.vel.y = -ig.game.player.jump_speed;
}

if (ig.game.player.vel.y > 0) {
ig.game.player.currentAnim = ig.game.player.anims.fall;
}


I hope this is the right solution, but I wonder still if this is the clean solution of this problem....

8 years ago by Joncom

The cleaner solution would be to keep that stuff in your player, not in main.js. Pretty sure .standing should be true while you're on a FIXED entity platform. Try adding console.log(this.standing); as the very first line in your player update function. Also try adding it as the very last line in your player update function. I bet you it's true at some point...

8 years ago by Arturo

Quote from Joncom
The cleaner solution would be to keep that stuff in your player, not in main.js. Pretty sure .standing should be true while you're on a FIXED entity platform. Try adding console.log(this.standing); as the very first line in your player update function. Also try adding it as the very last line in your player update function. I bet you it's true at some point...


You were right. Now it works on player great. The problem was that I got that part of the code just after this.parent(); and not before... and after parent make .standing true. Thank you so much for your help again :)

8 years ago by Joncom

No problem!
Page 1 of 1
« first « previous next › last »