Make wall's passable under certain conditions?

0 favourites
  • 5 posts
  • Hi , i have a game that involves a ball you can throw and catch from a top down perspective. The walls stopping the ball from bouncing under the screen need to allow the ball to pass through them under a certain condition as the game is 2-player and split down the center of the screen(like a tennis court).

    So at the moment the ball will bounce from wall to wall when thrown,

    but i need the ball to be able to pass 'over' the center wall when a

    certain button is held(in order to pass to the other player).

    I can't seem to think of a way to do this without breaking something,

    so if anybody has any idea's or similar experience in their own projects, i would like to hear them.

    So, In conclusion i need the ball to be able to bounce off the wall when it's idly bouncing around, and pass through the wall(or over) when the player 'throws' it.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    1. Put all the walls on the same layer, and give all the walls (but the center wall) a "solid" behavior.

    2. Create another layer, put it under the current layer, and then put the center wall in that layer.

  • I'm sorry, i should have been a little more clear on two things.

    1. The center wall i need to only be passable when the player 'throws' the ball(holding a button to catch and releasing to throw,Still haven't figured this out, but it's the concept) , You can also simply run into the ball and it will bounce around , which brings me to my second point.

    2. All of the objects in the scene that interact with the ball in some way are physics objects, mainly becuase that was the only way i could figure out how to get what i wanted working. Will simply changing the walls to solid in the middle work? If i want the ball to bounce off the middle wall when it bounces around, yet want it to be able to go over when thrown then surely it needs to be passable for the throw and impassable for the collision?

    Thanks for such a quick reply by the way,Paul.

  • On whatever button pressed, disable collision in the center wall; on button released, re-enable it.

    I think that works with physics objects...

  • Hmm i just tried it, but it seems to create a problem where now my player object can pass through the wall, I also want it so that when i press a button(as the ball collides with the player) he can 'grab' it, and then hold it before releasing to throw the ball,

    much like in the game warlords to an extent. ( 0.33 demonstrates the player 'holding' and then releasing the ball)

    After releasing is when i want that middle wall to no longer be an obstacle, so i'm assuming it's on button released that i want to use to disable to collision.

    But how can i do this and stop the wall from becoming passable every time the player presses and releases the key when they don't have the ball?

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