old_blueyes Posted September 12, 2018 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 Link to comment Share on other sites More sharing options...
old_blueyes Posted September 13, 2018 Author Share Posted September 13, 2018 Sorry to bump the post, but could anyone please help? Link to comment Share on other sites More sharing options...
kvazmatik Posted September 13, 2018 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. Link to comment Share on other sites More sharing options...
samme Posted September 13, 2018 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 Link to comment Share on other sites More sharing options...
old_blueyes Posted September 13, 2018 Author Share Posted September 13, 2018 many thanks both, hugely appreciated... also some good advice Link to comment Share on other sites More sharing options...
kvazmatik Posted September 13, 2018 Share Posted September 13, 2018 @samme TIL ignoreIfPlaying ?. But that will not solve his problem cause it'll trigger animation multiple times. Link to comment Share on other sites More sharing options...
Recommended Posts