How do I stop my character when is in collision with wall?

0 favourites
  • 6 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • I created a character with several running animations. When this hits the wall, the animation creates a bug. I would like to make it stop only when it hits the wall but I can't in any way. I can't create an invisible square because the collision is in his feet so it would conflict with the ball.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I read something like that:

    "It´s a good idea to have a single (invisible) sprite without animations that serves as the characters collision box and have the actual sprite pinned to the invisible one."

    But I didn't quite understand what it was. Could someone help me create it?

  • I didn't see any responses yet so I'll take a stab at it.

    I made a quick video to demonstrate using pin-to and a hitbox concept.

    I used overlap and did not make the hitbox invisible for the demonstration.

    There's a few other choices you can make to meet your needs. There are a couple of ways you can set the pin. I chose to do it based on an object and it's image point. You can modify that within your sprite to create a second image point such as your sprite's feet and refer to that. It will be messy because you have to set up that second image point for each frame and where the feet are in each frame compared to previous. This is common with weapon animation. But I don't want to get off topic.

    I am using a hitbox myself to engage and disengage an enemy.

    I show you my simple code and while I have not restricted any type of sprite I am searching for an enemy overlap with the player. You may be able to do that with the ball sprite and the feet and a different event for other similar needs. For example, I would do this for other objects such as NPCs, or clickable objects where a block behavior may be too restrictive for me. Anyhow, I don't want to get off topic.

    youtu.be/XGJi1oAOA7I

  • I read something like that:

    "It´s a good idea to have a single (invisible) sprite without animations that serves as the characters collision box and have the actual sprite pinned to the invisible one."

    But I didn't quite understand what it was. Could someone help me create it?

    Please see the example. There is a hidden hit box.

    https://editor.construct.net/#open=kiwi-story

    I recommend to read the other examples.

  • I didn't see any responses yet so I'll take a stab at it.

    I made a quick video to demonstrate using pin-to and a hitbox concept.

    I used overlap and did not make the hitbox invisible for the demonstration.

    There's a few other choices you can make to meet your needs. There are a couple of ways you can set the pin. I chose to do it based on an object and it's image point. You can modify that within your sprite to create a second image point such as your sprite's feet and refer to that. It will be messy because you have to set up that second image point for each frame and where the feet are in each frame compared to previous. This is common with weapon animation. But I don't want to get off topic.

    I am using a hitbox myself to engage and disengage an enemy.

    I show you my simple code and while I have not restricted any type of sprite I am searching for an enemy overlap with the player. You may be able to do that with the ball sprite and the feet and a different event for other similar needs. For example, I would do this for other objects such as NPCs, or clickable objects where a block behavior may be too restrictive for me. Anyhow, I don't want to get off topic.

    https://youtu.be/XGJi1oAOA7I

    So if I understand correctly, I create a hitbox around the player and if it overlaps with the wall, I do "stop direction"? (in my case 8 directions) right?

  • > I read something like that:

    >

    > "It´s a good idea to have a single (invisible) sprite without animations that serves as the characters collision box and have the actual sprite pinned to the invisible one."

    >

    > But I didn't quite understand what it was. Could someone help me create it?

    Please see the example. There is a hidden hit box.

    https://editor.construct.net/#open=kiwi-story

    I recommend to read the other examples.

    I checked the example, very interesting. Is this the yellow object colliding with the purple "collision" object?

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