How do I find the closest empty spot next to my object?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi!

    In my game the player can throw rocks and then collect them back.

    The problem is that sometimes they will fall on top of solid objects and the player can no longer reach them.

    I would like to make it so that if the rock falls on top of a solid object, then it should be moved to the next free spot (a spot where there is nothing with the solid behavior) on the level.

    How would you program something like this?

    Tagged:

  • The custom movement behavior has a 'Push out solid' action.

  • Bullet behavior can bounce off solids too.

    If this doesn't help, please give more details about your game - is if top-down, platformer, or something else? Which behaviors are you using?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for helping!

    Didn't know about "push out solid", that one turned out to be really helpful in my situation.

    As for the bullet, I was indeed using the bullet behavior but then when hitting a solid object, I would change to the tween behavior to be able to use those nice "bounce out" curve eases. The animated bounce part was the tricky one which would sometimes put the rock inside a solid. But push out solid worked to help with those situations. The game has a top down perspective.

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