How do I prevent an object to pass through another object.

0 favourites
  • 6 posts
From the Asset Store
Assets for creating mountains and ravines environments
  • Hi Guys,

    I have two objects in my game. A ball and a vertical line. The ball has Custom movement and Solid behaviors. The line has a solid behavior. Now when I try to pass the ball through the line, it shouldn't pass. How can I achieve this.

    I tried giving Physics behavior to the line and made it immovable, but still the ball is passing.

    Any help much appreciated.

    Thanks.

  • The custom movement behaviour has the "push out solid" action..

    That action should get you the results you want..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    Thanks for the reply.

    My understanding of "Push out solid" action is that upon collision with the line, it would push the ball to some direction based on our selection. Does it block the object?

    Also I wrote an event line --if the ball collides with the line---> "push custom movement out of solid in opposite direction" on the ball.

    This too doesn't seem to do anything. I can still pass the ball through the line.

    Can you help me if I am writing the event wrong.

    Thanks and Regards.

  • It's been a while since I've used it, but if I remember correctly, using is overlapping instead of on collision would help..

  • Thanks for the reply. I tried to "STOP" the ball on "Overlapping with other object" but it still is not giving the desired functionality according to my game. I will do a few tweaks hear and there to see if I get my desired result.

    Meanwhile if any one knows how to achieve it, please do help me. I got struck at this point.

    What I want is to achieve how an object would get blocked when it has 8 direction behavior, but with custom movement.

    Thanks.

  • Ok..I got one way of doing it..on collision I can write an event to move the ball in opposite direction 2px.

    I'm loving Construct 2.

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