Character - Double Jump

19 October 2016 03:03 #12831
Hello B4W team!

Do you have any suggestions for programming a 'double jump'.

If I hit space again while the character is in a current Jump I want him to jump again in the air.

I'm using this sensor and function:

var jump_cb = function(_character, id, pulse) {
m_ctl.create_sensor_manifold(_character, "JUMP", m_ctl.CT_SHOT, [key_space], null, jump_cb);
22 October 2016 01:43 #12948
I'm not sure but there is a part of the manifold that is called logic. It should return True for the callback to trigger. Maybe you can have two True logic outputs from that function.
Something like three states or what 0 can jump return's true state = 1, if state equal 1 returns true again, state = 2. f state equal 2 returns false. When you land state =0 again.
Maybe not the best idea but could probably work.

Best regards
22 October 2016 06:43 #12949
Thanks Luke, good idea I'll try it out!
23 October 2016 13:07 #12957
Great ! I was not sure that would help. I struggle with these manyfolds myself. But the api describes quite well what every argument in the function should be. There is also an example in the documentation that is quit helpful to get an idea of what is going on !

MAYBE ? You could use two manifold with different logics.
something that return true when the key down && not jumping
a second for double jump that returns true only if key down && jumping.
That way your two callbacks can be different if you don't want the exact same jump when you double jump.

Thats only as far as i understand. But thats what i understand from the game tutorial.
Please register or log in to leave a reply.