Help needed in fixing character animation

Although this is not specifically slide-off, this also sometimes occurs when I click on the button, hold, and drag out of it.

I’m sorry, but the Input Devices sample is the only directional key that does not give me any problems. But the usage of frame-by-frame movement with physics is sloppy and unsafe…

OK, you’re right, back to the drawing board… I was able to get the tutorial code to “keep moving” with a super-fast slide-off. I know why it’s happening, but I need to figure out a solution. 

Thank you. I was beginning to get frustrated because I was sure I had done everything as you asked in the tutorial.

Hi, Brent, I just wanted to let you know that even though the tutorial was taken down, it is still accessible by this link: 

https://docs.coronalabs.com/tutorial/events/continuousActions/index.html

 

Just to let you know.   :slight_smile:

Of course, when it is fixed the new one will replace it. 

 

Also, when do you believe you will have the tutorial fixed? Not to rush you, but just to get an estimate, as I start 9th grade this Monday, and I am sure you are busy with other things.

The improved version will be ready before Monday. :slight_smile:

Thank you very much!

OK, all ready! This one is considerably different than the previous (in code), so get ready to revamp your game code quite a bit if you choose to use this method.

https://docs.coronalabs.com/tutorial/events/continuousActions/index.html

Brent

Wow, thanks so much! I’ll start implementing right away!

Hi Brent, everything seems to be working ok except for one thing if I click on an area that is not on my button but still within the group region it jumps. Meaning that when I came to test the sliding: 

https://www.youtube.com/watch?v=GX4k7jRmE1w&feature=youtu.be

Notice how the character jumps when I press and then starts moving when my mouse reaches the button? Also, here is the area that my groupRegion covers:

Does this occur on your side too?

Never mind I fixed it, just added an extra return true statement. 

local function functionDirectionalKeys(event) local touchOverButton = detectButton(event) if event.phase == "began" then --etc. etc. elseif ( event.phase == "ended" and directionalKeyGroup.activeButton ~= nil ) then directionalKeyGroup.activeButton = nil anim:setLinearVelocity(0, 0) anim:setSequence("idle") anim:play() return true end return true --extra return statement end

Thanks for everything Brent, now it works completely! 

I can finally wrap up this topic.

Great to hear! Let me know if you encounter any other oddities. I think the tutorial nails all of them, but there may be some outside edge case I didn’t consider.

Brent

None yet, so far!

Hey there, Brent, I have been able to get the character to continue sliding on Live Builds. Here is the APK, so you can see for yourself:

https://github.com/sdktester15/SlidingProblem

When you have time, please fiddle around with the controls until you are able to get the character to slide. :slight_smile:

I’ll respond to this one as well: did you implement the “foot sensor” as I suggested yesterday?

If that’s not a viable solution, then I think you’ll have to add in detection for the character’s linear velocity (downward Y) upon hitting a platform. If it’s positive (thus player is not in “upward jump”) then I guess you can set the sequence to idle… that might handle almost every instance of case #1.

For #2, this is another case where you should have a “flag” of some sort which tells you “is the character currently in a jump?”. The foot sensor method is one way, but other people find other ways. In any case, you should set a flag like that and then, if the player presses left/right during that point, the sequence does not change.

My problem is that the jump is in one frame, it is a touch listener, not a runtime listener.

I guess I will try to change the jump from a touch to an enterFrame.

Not sure how that changes things. I assume jump is done with a touch event on your UI “Jump” button? If so, just set a flag when the jump starts and reset it when the jump ends.

I change the linearVelocity check to a foot sensor check. The only problem is now I have to Live Build my app to test for bugs. (I don’t want to make functionality for arrow keys just for testing ( ͡° ͜ʖ ͡°) 

Also, I want to learn how to Live Build, so I will give it a try. 

Then, I will use the flag as you recommended.

Thanks!