Collision+movement...

0 favourites
  • 6 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Maybe I'm missing something, but how do I have a collision box at an angle, and have my player walk directly into it, but it pushes him the correct way he needs to move? For example, if he's moving up, and he hits an angle, he should move up still, but at the angle of the collision.

    How can this be accomplished smoothly in C2?

  • It involves finding the angle of the spot on the polygon the player hit and canceling the speed moving against the object. You can look here for a few examples you may be able to use in your game.

  • Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It involves finding the angle of the spot on the polygon the player hit and canceling the speed moving against the object. You can look here for a few examples you may be able to use in your game.

    Umm, which of these would best suit a player moving around objects that are on a tilemap? You have like five hundred examples </exaggeration>

  • With a tilemap I don't think any of them will help, since all those get a collision shape either by using imagepoints or using the size and angle of the object to calculate the collision polygon. Tilemaps are different. For them to work we first need to find the tiles the player overlaps, then treat each tile as a separate object. It's doable, but I'm very slow at coding lately and I have other things I'd like to work on first.

    Another way to do it is to use a different approach. Instead of figuring out the collision polygon, we could use collision checks with moving around a little to find the approximate angle of the hit edge. The closet existing capx to that would be this, but it would need more work to get it to handle sliding on more angles.

    By far the simplest thing to do would be to just use the physics behavior, which probably would look alright.

  • I'll look into your example more closely. I did try physics but my character kept sliding around. when colliding with square collision objects, and I don't know why. But I'll see what I can gain by looking at your stuff there, I'm sure I can figure something out.

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