Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Falling Bug #16

Closed
kosinix opened this issue Oct 2, 2011 · 9 comments
Closed

Falling Bug #16

kosinix opened this issue Oct 2, 2011 · 9 comments

Comments

@kosinix
Copy link

kosinix commented Oct 2, 2011

Hi,

First, this is a great javascript engine. I ported an old platform game I made in flash. However, there is one critical bug when falling from high places. For example, when jumping from high platform the hero goes through a solid tile. My theory is this has something to do with the acceleration of the fall greater than the height of the solid tile, as I encountered this kind of bug with my flash engine from long time ago. Just hoping you could check this bug, that would be really cool.

thanks! Really nice game engine.

@melonjs
Copy link
Collaborator

melonjs commented Oct 3, 2011

oooh, thanks for reporting this ! But yes for sure you certainly right, I'll look into it.
Would you share with me your example ([email protected]), so that I have an example to debug ?

How did you fix this in your flash engine ?

And thank you, melonJS is for sure not yet perfect, but I'm happy you like it !

@melonjs
Copy link
Collaborator

melonjs commented Oct 6, 2011

Following email discussion with nicnacks on this, For those having the same issue, and while waiting for this to be managed correctly, you can use the setMaxVelocity function to cap the y velocity.

@amauch
Copy link

amauch commented Oct 10, 2011

My question has similar contexts, but how can you kill your character when he/she has falling through a hole/pit. Say you are jumping from platform to platform over a big whole, and you miss the next platform and fall "to your death." What do you need to add in JavaScript to handle this issue? What I want to do is just restart the level.

@melonjs
Copy link
Collaborator

melonjs commented Oct 10, 2011

Actually you have two options :

1/ check the y position of the player, if y > than the level height, you can assume that you felt into a pit/hole.
this is exactly what I'm doing in Alex4, when the position is updated I have the following code :

// check if we fall somewhere
if (this.pos.y > this.ylimit) // <- ylimit being the vertical limit of the level
{
this.die();
}

2/ you can use a invisibleEntity, and make it die or go to the next level when the player touch it
This is also what I'm doing in Alex4 (in case you played it) : when you reach the end of the 1st level, you have to jump into the pit to access the next level.

I can send you alex4 source code if you want, just send me an email to [email protected]
Actually I think I should post the source of it as well, maybe add a link to it in the gallery page.

@parasyte
Copy link
Collaborator

parasyte commented Sep 9, 2012

I created a new ticket for doing collisions in multiple phases, mostly as a performance improvement. But it will also solve this bug by taking the guesswork out of the collision resolutions: #103

@obiot
Copy link
Member

obiot commented Jul 28, 2014

should be covered through #538, closing this one

@obiot obiot closed this as completed Jul 28, 2014
@parasyte
Copy link
Collaborator

Reopened, since this is still an issue, as demonstrated here (using melonJS build 518 from Travis-CI): http://jsfiddle.net/4s1rauye/

@parasyte parasyte reopened this Oct 13, 2014
@parasyte
Copy link
Collaborator

To make the ball properly hit the wall. Lower the velocity on line 59 like this:

this.body.vel.set(12, 0);

Then note that the ball still falls through the floor (which is only 1px thick)

@parasyte parasyte modified the milestone: 1.3.0 Oct 22, 2014
@parasyte parasyte modified the milestones: 2.2.0, 2.1.0 Feb 8, 2015
@parasyte parasyte modified the milestones: 3.0.0, 2.2.0 Jul 9, 2015
@parasyte parasyte modified the milestones: 3.0.0, Future Jul 26, 2015
@obiot obiot removed this from the Future milestone Nov 7, 2017
@obiot
Copy link
Member

obiot commented Nov 7, 2017

ok, I'm closing this one for the following reasons :

@obiot obiot closed this as completed Nov 7, 2017
hornta pushed a commit to hornta/melonJS that referenced this issue Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants