0 Favourites

8dir-plugin collision-wall MAD animations

  • hello people,

    i have a serious problem due to the way the 8-dir-behavior manages collisions between player sprite and solid-walls.

    I've associated animations "idle" and "walk" if the Player is moving or not, The plugin however causes that when the sprite collides the solid wall, is automatically stopped then moves a few pixels then stops again, and so on for a fraction of a second during which the above animations obviously change madly from one to the other '..

    I'm really annoyed about this thing so much that I opened a dedicated topic in the "bug" section, nevertheless I decided to open this other topic even if someone could suggest some solution.

    Thanks to whoever wants to help me

  • any idea or workaround about to solve this issue?? i have tried lots but nothing to do, im still trouble with this..

  • This doesn't really sound like a bug, more of a logic problem in the event sheet for the animations. Do you mean the built-in 8-direction or are you referring to a third-party plugin of some kind? You just need to find a way of splitting out the animations, probably have when key is down/key is not down, rather than when player is not moving.

  • This doesn't really sound like a bug, more of a logic problem in the event sheet for the animations. Do you mean the built-in 8-direction or are you referring to a third-party plugin of some kind? You just need to find a way of splitting out the animations, probably have when key is down/key is not down, rather than when player is not moving.

    8direction plugin due to they manner of manage collision, that when overlap a solid move the sprite some pixels forward and back few times. this is the result (notice the animation switch madly when approach the invisible solid wall):

    NB all sprites are perfectly squared box collision

    https://youtu.be/1rQY0_Ne_KY

  • As mentioned, this just looks like it is setting to an idle animation when you hit the wall because the player 'is not moving', therefore it will look like the animation is skipping.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • As mentioned, this just looks like it is setting to an idle animation when you hit the wall because the player 'is not moving', therefore it will look like the animation is skipping.

    logic is simpe, a box with 8dir behavior, and a sprite everityck set position to the box, that change animation from idle to walk if the 8dir is "on moving" inverted, or "on moving".

    look at this, is the same thing, but without pinned sprite, only a change colour animation.

  • All behaviors that combine 'Deceleration' with a 'Push out of Solids routine' suffer from this.

    The object does not have instantly a speed = zero when the collision happens, it decelerates.

    It also never exactly ends up where the 'Push out of Solids routine' wants to place it, because of the deceleration.

  • All behaviors that combine 'Deceleration' with a 'Push out of Solids routine' suffer from this.

    The object does not have instantly a speed = zero when the collision happens, it decelerates.

    It also never exactly ends up where the 'Push out of Solids routine' wants to place it, because of the deceleration.

    Ok, so i can not make my game because the behavior is badly programmed?

    Is there not a way to solve it?

  • If a behavior is holding you back, then you can indeed not make a game.

  • If a behavior is holding you back, then you can indeed not make a game.

    Is there something in which you can be useful apart from the chats that do not interest me?

    Because if it is the only contribution you can give, you better go for a bath.

    I have a serious problem I am not here to waste time

  • Last I looked, the 8dir behavior collisions work like this:

    Move the object with it's speed

    if the object overlaps a solid then move it back to it's last non overlapping position and set the speed to 0

    It's a valid way to do it, but it can cause it to stop short of the solid, then speed up again to close the smaller and smaller gap. Aka the effect you are observing.

    So a more desirable behavior would be for the overlapping object to move flush against the solid before stopping.

    Maybe by not using the solid behavior, and using the push out action of the customMovement behavior when overlapping the wall sprite or just doing your own push out with events. I think there have been some other topics with examples of a push out with events.

    Another idea is to keep track if the object is moving or not over multiple frames and only change the animation if it has stayed the same over multiple frames. That should eliminate most of the flickering with the only drawback of causing a slight frame delay for animation changes. So for example if you keep track of 4 frames it could look like this:

    global number f1=0

    global number f2=0

    global number f3=0

    global number f4=0

    every tick

    --- set f4 to f3

    --- set f3 to f2

    --- set f2 to f1

    sprite is moving

    --- set f1 to 1

    else

    --- set f1 to 0

    compare f1+f2+f3+f4 = 4

    --- set animation to walking

    compare f1+f2+f3+f4 = 0

    --- set animation to stopped

  • Last I looked, the 8dir behavior collisions work like this:

    Move the object with it's speed

    if the object overlaps a solid then move it back to it's last non overlapping position and set the speed to 0

    It's a valid way to do it, but it can cause it to stop short of the solid, then speed up again to close the smaller and smaller gap. Aka the effect you are observing.

    So a more desirable behavior would be for the overlapping object to move flush against the solid before stopping.

    Maybe by not using the solid behavior, and using the push out action of the customMovement behavior when overlapping the wall sprite or just doing your own push out with events. I think there have been some other topics with examples of a push out with events.

    Another idea is to keep track if the object is moving or not over multiple frames and only change the animation if it has stayed the same over multiple frames. That should eliminate most of the flickering with the only drawback of causing a slight frame delay for animation changes. So for example if you keep track of 4 frames it could look like this:

    global number f1=0

    global number f2=0

    global number f3=0

    global number f4=0

    every tick

    --- set f4 to f3

    --- set f3 to f2

    --- set f2 to f1

    sprite is moving

    --- set f1 to 1

    else

    --- set f1 to 0

    compare f1+f2+f3+f4 = 4

    --- set animation to walking

    compare f1+f2+f3+f4 = 0

    --- set animation to stopped

    thank you very much for the great help, im actually avoiding the problem using 4 different (non solid) sprites for wall of the rooms, that system work decently, only thing is the problem with irregular wall position, for example wall at differents angle..

  • Maybe more carefully placed walls? I haven't tried something like that.

  • Maybe more carefully placed walls? I haven't tried something like that.

    You can try it yourself, voilà a sample capx..

    https://drive.google.com/open?id=0BwNG7 ... GdOa21Pc2c

    the player box overlap a bit the wall, but in the game i place the invisible wall a little further towards the inside of the room, so the thing is not even noticeable.

    The problem I spoke to you is when I use sloping walls at various angles, in those cases I have not yet felt good how to do that.

  • There's no diagonals in your capx. Anyways the idea's only fault is how far you overlap the wall depends on the speed, which may or may not be acceptable for your purposes. I'd guess in general for any wall in your game you'd put those wall sprites around them. For diagonal you may need to put two of them. Like for a diagonal going down and to the right you'd put a bottom and left sprite along the top right of the sprite.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)