old_blueyes 0 Posted September 12, 2018 Report Share Posted September 12, 2018 Hi, Hope somebody can help, I have a sprite which i've coded to animate on overlap. But it's acting very strangely, currently when the sprite overlaps it will trigger the first frame of the animation. Which stays as a still frame, until the sprite finishes the overlap of which then the rest of the animation plays out. It's like there's a delay on the animation somewhere, can't figure out where. If there is, it would be strange as it switches to the first frame of the animation. But it should be one continuous motion. Appreciate it if anyone can take a look: https://codepen.io/old_blueyes/pen/GXxBmm Thanks Quote Link to post Share on other sites
old_blueyes 0 Posted September 13, 2018 Author Report Share Posted September 13, 2018 Sorry to bump the post, but could anyone please help? Quote Link to post Share on other sites
kvazmatik 16 Posted September 13, 2018 Report Share Posted September 13, 2018 @old_blueyes ,You need disable fence's collision check after overlap is triggered, otherwise it'll be triggering every frame until it jumps out overlap. fence.body.checkCollision.none = true; add that code at line 218 in your code. in jumpFence function. Quote Link to post Share on other sites
samme 722 Posted September 13, 2018 Report Share Posted September 13, 2018 First make sure the animations work like you expect without any collision checking. Just add and play. If the overlap is continuous, you'll be restarting the animation each time. You can use ignoreIfPlaying=true in play(). kvazmatik 1 Quote Link to post Share on other sites
old_blueyes 0 Posted September 13, 2018 Author Report Share Posted September 13, 2018 many thanks both, hugely appreciated... also some good advice Quote Link to post Share on other sites
kvazmatik 16 Posted September 13, 2018 Report Share Posted September 13, 2018 @samme TIL ignoreIfPlaying 😃. But that will not solve his problem cause it'll trigger animation multiple times. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.