Make wall's passable under certain conditions?

Get help using Construct 2

Post » Thu May 09, 2013 12:40 am

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.

Thanks,Paul.
B
5
Posts: 47
Reputation: 392

Post » Thu May 09, 2013 12:48 am

OPTIONS:
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.
B
16
S
5
G
3
Posts: 47
Reputation: 2,276

Post » Thu May 09, 2013 12:58 am

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.
B
5
Posts: 47
Reputation: 392

Post » Thu May 09, 2013 1:45 am

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

I think that works with physics objects...
B
18
S
5
G
1
Posts: 95
Reputation: 2,666

Post » Thu May 09, 2013 3:51 am

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. (http://www.youtube.com/watch?v=tW3HXWPh41g 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?
B
5
Posts: 47
Reputation: 392


Return to How do I....?

Who is online

Users browsing this forum: selaus and 0 guests