Stopping against a solid <RESOLVED>

0 favourites
  • 8 posts
  • Dear all.

    Noob question #3

    Okay, I have my object moving about the screen and I have a object with the solid behaviour assigned to it.

    When my movable object comes into contact with the solid object, it just passes straight through as if it wasn't there.

    I can detect contact as I have triggered other events when they touch; however, how do I make the solid actually act as a solid and prevent my movable object from passing though it?

    Other than the 'solid' behaviour, I want to do this using events only.

    Many thanks.

    Noob

  • ther than the 'solid' behaviour, I want to do this using events only.

    Than the solid behavior is useless. By design it is supposed to interact with object having behaviors like 8direction, car or even platformer behavior.

    Since you are already determining when you have a collision in event, then "bypass" your movement at this moment.

    This depends on how you have implemented the moving of the object. Without a capx, hard to figure/answer.

  • Make the solid object have a physics behavior and set this object to be immovable.

  • Tuiii it will only work if the base moving object has a physics behavior too.

  • Oh, didn't see he said he wanted only the solid behavior. Well.. capx would help to understand better here indeed.

  • You are going to have to do collision detection manually in events, which is quite annoying.

    Essentially, you should do some reading about how collision detection works, but basically it detects whether an object has collided with another, and then checks if that object has a solid attribute, and then pushes it back to the last position it was at. Alternatively you can calculate whether or not the next movement will collide (in the next frame), and have the main character not move in that direction.

  • Thank you, all.

    I do search the forums and examples prior to asking questions here, but maybe their very simplicity means I get 1000s of unrelated results!

    Thank you for exlaining that the solid behaviour only works with other behaviours and that, therefore, my only option is to perform a fiddly advance check on key press, but before movement.

    Perhaps I'm trying to reinvent the wheel here, hmmmm!

    Noob

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the Search options, be sure to select the forum "Construct 2 general". If nothing useful pops up select the forum "How do I".

    The answers will only concern C2.

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