Ir para o conteúdo
Avatar do Ned, mascote do GNORGNOR

Character shaking or sticking to the wall in Construct 3? Understanding collisions

Character shaking or sticking to the wall in Construct 3? Understand collision You add the Platform behavior to the character, set the floor and walls to Solid, press Play, and… the character sticks to the wall. Or shakes in place. Or seems to “stutter” when switching animations. Don’t worry: this usually isn’t some mysterious Construct…

Ned7 min read

Personagem tremendo ou grudando na parede no Construct 3? Entenda a colisão

Character shaking or sticking to the wall in Construct 3? Understand collision

You add the Platform behavior to the character, set the floor and walls to Solid, press Play, and… the character sticks to the wall. Or shakes in place. Or seems to “stutter” when switching animations.

Don’t worry: this usually isn’t some mysterious Construct bug. Most of the time, the problem is in one of these three places:

  1. the Collision Polygon changes between animation frames;
  2. the origin shifts between frames;
  3. the Platform behavior is applied directly to the animated sprite.

Let’s look at why each one causes the problem, then put together the solution recommended in Construct’s own documentation.

If this is your first week with the engine, it’s worth reading How to get started with Construct 3? Get to know the engine before creating your first game 🎮 first.

🧠 First things first: the image isn’t what collides

💡 Concept

When two objects touch in Construct, the engine doesn’t look at the image’s pixels. It looks at the collision polygon: an invisible geometric shape associated with each sprite frame.

Think of it this way: the image is the character’s clothes. The collision polygon is the real body. The clothes can be loose and rounded, but it’s the body that hits the wall.

Now, back to the technical concept: each animation frame can have its own collision polygon. And that’s where a lot of the problems come from.

Culprit 1: the collision polygon changes between frames

The Platform behavior constantly checks whether the character is touching something solid. It needs to know where the floor is, where the wall is, and whether there’s a slope.

Now imagine the character touching the wall. The animation switches frames, and in the new frame, the polygon is a little wider. Suddenly, part of the “body” is inside the wall.

The Platform behavior wasn’t expecting that. It tries to resolve the situation, and you see the result as shaking, getting stuck, or moving awkwardly.

See? The character didn’t “decide” to stick to the wall. The collision shape changed size along the way.

How to check:

1 – Double-click the character’s sprite to open the Animation Editor.

2 – Select the Edit Polygon tool.

3 – Go through the frames of each animation and check whether the polygon changes shape or size.

How to fix the most common case:

1 – With the Collision polygon tool active, right-click the canvas and choose Set to bounding box. This turns the polygon into a simple rectangle.

2 – Right-click again and choose Apply to whole animation so all the frames in that animation use the same polygon.

3 – Repeat for each animation (idle, running, jumping…).

    ⚠️ Caution

    “Apply to whole animation” applies to the animation that’s open. If your character has five animations, you need to check all five.

    Culprit 2: the origin shifts between frames

    💡 Concept

    The origin is the point on the sprite that represents the object’s X and Y position in the game. It’s also the axis the object rotates around.

    Think of the origin as a pin holding the drawing to the board. When Construct says “the character is at X = 200,” the pin is at X = 200. The rest of the drawing, along with the collision polygon, is positioned relative to that point.

    In technical terms: if the origin is at the feet in one frame and three pixels higher in the next, the whole drawing “jumps” when the animation switches frames. The polygon jumps with it. And a jumping polygon can end up inside the wall, just like in culprit 1.

    How to fix it:

    1 – In the Animation Editor, select the Image Points tool.

    2 – Position the Origin. In a side-view platform game, the most practical spot is usually the bottom center, at the character’s feet.

    3 – Use Apply to whole animation to apply that position to every frame.

    4 – Repeat for each animation and check frame by frame that the point really stays in the same place on the drawing.

      🧪 Try it out

      Want to see the problem happen on purpose? On a character that already works well, move the origin of a single frame five pixels up. Run the game and watch the character standing still.

      Did you see the shaking? Now put the origin back where it was and run it again. That’s the cause-and-effect relationship you’ll recognize in your next projects.

      Culprit 3: Platform is on the animated sprite

      Even with polygons and origins set up correctly, there’s an official recommendation that solves the problem at its root.

      Scirra’s platformer tutorial recommends applying the Platform behavior to an invisible rectangle with no animations, then positioning the animated sprite on top of it. The reason is the same one we’ve seen so far: changing frames can leave the object partly inside the wall and confuse Platform.

      In other words: instead of trying to make the animation behave, we separate responsibilities.

      🧠 Think of it this way

      • PlayerBox: the body. A rectangle that never changes, invisible, with the Platform behavior. It moves, jumps, and collides.
      • PlayerAnim: the outfit. The sprite with all the animations, without Platform. It just follows PlayerBox.

      Since PlayerBox doesn’t animate, its polygon never changes size. Platform always knows exactly where the body is.

      ⚠️ Careful

      This article is about side-view platform games that use the Platform behavior. If your game is top-down, the most common behavior for movement is different (8 Direction), and the diagnosis may be different.

      🛠️ Setting up the PlayerBox + PlayerAnim pattern

      The body (PlayerBox):

      1 – Create a new Sprite and draw a rectangle in any color. Rename it to PlayerBox.

      2 – Set its size to roughly match the character’s body, without arms, weapons, or hair sticking out.

      3 – Put the Origin at the bottom center.

      4 – Leave the collision polygon as a rectangle (Set to bounding box).

      5 – In the object properties, uncheck Initial visibility.

      6 – Add the Platform behavior to PlayerBox (and remove it from the animated sprite, if it was there).

        The outfit (PlayerAnim):

        1 – Use the animated sprite you already have. Rename it to PlayerAnim if you want to make things clearer.

        2 – Check that the Origin is at the feet in every frame of every animation.

          The rule that connects the two:

          In the Event Sheet, create an event:

          • Condition: System → Every tick
          • Action: PlayerAnim → Set position to another object → PlayerBox

          The image point parameter can stay at 0, which corresponds to the origin. Since both have their origin at the feet, the clothes line up exactly with the body.

          The scene:

          The floor and walls get the Solid behavior. Platforms that the character should pass through from below and stand on from above get Jump-thru.

          Now test it: walk into walls, jump, touch the edges, and switch animations. The Platform behavior comes with keyboard controls ready to go (the Default controls property), so you can test without creating any movement events.

          Samurai andando

          🧪 Try it

          During the test, check Initially visible for PlayerBox again. Run the game and watch the rectangle and the animation move together.

          Notice that the rectangle touches the wall, not the artwork. Now make PlayerBox wider and watch the character stop farther from the wall. Make it too narrow and watch the artwork “enter” the wall. Find a size that looks right, then turn visibility off again.

          💥 Still shaking or sticking? What to check next

          With the standard PlayerBox + PlayerAnim setup, only PlayerBox collides. So the diagnosis shifts:

          • Shaking or sticking: check PlayerBox (size, origin, collision polygon) and the scene objects where the problem occurs. Is Platform really only on PlayerBox?
          • The animation “jumps,” but the movement is correct: now the problem is only visual. Go back to culprit 2 and check the origins of the PlayerAnim frames.

          ✅ Checkpoint

          • Construct uses the Collision Polygon for collisions, not the image.
          • A polygon or origin that changes between frames can leave the character partially inside the wall.
          • The recommended solution is to separate the body (PlayerBox, with Platform) from the clothes (PlayerAnim, with the animations).

          🎯 GNOR Mission

          1. Open the project where the character gets stuck (or create a new one with a floor and two walls).
          2. Set up the PlayerBox + PlayerAnim pattern.
          3. Test by walking into the walls and jumping near them.

          Bonus challenge: when the player walks left, PlayerAnim keeps facing right. Can you figure out how to make the clothes face the right way without changing PlayerBox?

          If your character got stuck, tell us in the comments which of the three culprits was yours.

          Next step

          Now we have a body that collides reliably and clothes that just follow along. But the clothes still don’t know when to run, jump, or fall. That’s the next problem: changing the animation based on what Platform is doing.

          Acknowledgments

          Samurai Sprite created by Mattz Art

          A big hug!

          ned despedindo

          Newsletter

          Keep exploring with GNOR

          Sign-ups aren't live yet: sending will be connected soon.

          Written by

          Ned

          Conversa

          Comentários

          Carregando comentários…

          Deixe seu comentário

          Sem cadastro: só nome e e-mail. Seu e-mail não aparece no site e é usado apenas para identificar o comentário.

          Comentários passam por moderação antes de aparecer.