Ok. I have implemented it. There is good news and bad news. The good news is I can’t replicate the sliding on my device. The bad news is the player now has another error. You see, the way I had fixed that problem before was by adding an if statement at the very top of the function:
local function functionDirectionalKeys(event) ----if anim.isJumping == false then local touchOverButton = detectKey(event) if event.phase == "began" then if touchOverButton ~= nil then if not directionalKeyGroup.touchID then directionalKeyGroup.touchID = event.id print(event.id) directionalKeyGroup.activeButton = touchOverButton if directionalKeyGroup.activeButton.id == "left" then walk(-1) elseif directionalKeyGroup.activeButton.id == "right" then walk(1) end end return true end elseif event.phase == "moved" then if touchOverButton == nil and directionalKeyGroup.activeButton ~= nil then event.target:dispatchEvent( { name="touch", phase="ended", target=event.target, x=event.x, y=event.y } ) return true elseif touchOverButton ~= nil and directionalKeyGroup.activeButton == nil and touchOverButton.canSlideOn == true then event.target:dispatchEvent( { name="touch", phase="began", target=event.target, x=event.x, y=event.y } ) return true end elseif ( event.phase == "ended" and directionalKeyGroup.activeButton ~= nil ) then directionalKeyGroup.activeButton = nil directionalKeyGroup.touchID = nil anim:setLinearVelocity(0, 0) anim:setSequence("idle") anim:play() return true end return true --end end
But it just so happened that was also causing the sliding. But now I am having the other problem.
I can’t record it, but you can replicate it.
On a post above, I placed a link, that link leads to the .apk file of my project. I replaced with a newer one. If you can, run it, and press the left or right directional key while in mid-air. You will see that it changes its animation sequence in the middle of the jump sequence. I think the reason this is happening is because of my setting the sequence to idle on the ended phase. I am going to try moving the conditional check there.
EDIT: That did not work.