ekeimaja Posted October 6, 2015 Share Posted October 6, 2015 Now I managed to get moving with mouse working. Now I am creating jumping, which is made by pressing left mouse button. How can I make my sprite to jump only ONCE, when left mouse button is clicked? I explain this kind of procedure:When you press left button of your mouse ONCE. I mean once when you press left mouse button with your index finger and then release it. LIke you clicked the link of this thread. When you click, sprite jumps ONCE and then falls back to floor. Not jump twice, not begin to flow on air. Just jumps once. Please, read this post once again before replying to this, so you fully understand my problem. Because I have seen too many threads on these forums where have been asked help i.e. for p2 physics, and somebody has answered with arcade physics code. Link to comment Share on other sites More sharing options...
tips4design Posted October 6, 2015 Share Posted October 6, 2015 Well, just use the onInputUp event, or similar, because you can not trigger up without first clicking down. And to make sure you can't click again while you are in air just keep a flag with didJump or isInAir which you reset when your sprite reaches the floor again. You can find more examples here: http://gamemechanicexplorer.com/#platformer-4 Link to comment Share on other sites More sharing options...
ekeimaja Posted October 6, 2015 Author Share Posted October 6, 2015 I have already looked that tutorial, but it does not help because it is for arcade physics. I use p2 physics. In my game, floor is NOT world bottom bound. Collision is made with polylines for layer. So it need collisioncheck between player and polylines. Does there exist that kind of feature? WIth collisiongroups any collision does not work. Link to comment Share on other sites More sharing options...
tips4design Posted October 6, 2015 Share Posted October 6, 2015 What do you mean by polylines? Do those polylines have a P2.Body attached to them? It does not matter that the bound is not the world bound, just detect the collision with built-in functions or manually check for intersections. Link to comment Share on other sites More sharing options...
ekeimaja Posted October 6, 2015 Author Share Posted October 6, 2015 I got it working. Made just timer to isDown function. Link to comment Share on other sites More sharing options...
Recommended Posts