Disable collision with specific object?

Get help using Construct 2

Post » Wed Jul 17, 2013 7:46 am

Hi guys, i recently changed my game from using physics behaviour to using bullet instead because the physics were becoming quite erratic.

The problem is , i had a system where when the left mouse button was clicked it would launch a ball which could pass over 'walls' i had in the game(Via on left-button clicked>Disable physics collisions with 'wall')

This not only allowed the ball object to pass through/over the wall, but also didn't stop the player from being unable to pass through it(something i want). Now , since switching to the bullet behaviour , the problems i had with the movement of the ball being slightly erratic are gone, however the only way i can find of doing what i did before is to disable solid collisions when the left mouse button is clicked, this sadly allows the player to pass through the wall too and i don't want that happening at ANY point during the game.

Can i make the solid wall permanently affect the player , but not the ball when the left mouse button is pressed?

Thanks,Paul.
B
5
S
1
Posts: 47
Reputation: 542

Post » Wed Jul 17, 2013 10:20 am

The bullet behavior won't be stoped by the collisions on its own. You would have to make a "on collision" -> "destroy" to make it stop when touching the wall, where the physics would do all the job. So there isn't a problem in fact, you just have to do nothing for the bullet to pass through the wall. Instead, you have to add events for the bullet to stop when it hits a real obstacle !
B
17
S
8
G
4
Posts: 461
Reputation: 6,097

Post » Thu Jul 18, 2013 5:34 am

Thanks for the reply Guizmus, I may be misunderstanding you but the problem is that when i launch the ball with the left mouse button it should pass through the wall, and when i use the right button to fire it, it should collide with the wall and stay in the 'lane' that the player is in. So when i left click, the only way i've been able to have it pass over the wall is to disable solid collisions with the wall in general, which allows my player to also pass through(what i don't want) , the right click isn't a problem off course because i have that set to re-enable the collisions with the wall and thus it works fine even after left-clicking.
However if i was to left click to pass the ball over the wall, receive it back again and then before i right click to fire it inside the lane i go in the direction of the wall, i pass through it.

Only once i click the right mouse button again are the collisions re-enabled and that seems to be where my problems lie.

Also when i refer to collisions now, i'm referring to the solid behaviour and NOT the physics collisions,
because i've taken all physics behaviour out of the game due to unsatisfactory results with the way the ball moves.
B
5
S
1
Posts: 47
Reputation: 542

Post » Thu Jul 18, 2013 5:36 am

Also I'm taking a look at the events tutorial in your signature and it seems to suggest it might answer some of the questions i've had as a new construct user, thanks for taking the time to write it up.

Paul
B
5
S
1
Posts: 47
Reputation: 542

Post » Thu Jul 18, 2013 6:48 am

Hey Paul,

Happy my tuto was useful.
About your problem, providing a sample capx could help understand what isn't working right now.
In doubt, I tried this capx where left click makes a bullet going through the wall, and right click makes it bounce on it. Not sure this is exactly what you needed though, but the events logic can then easily be changed, it was the collision detection that was your problem if I understand well.

Btw, when you're waiting for an answer from someone, or talking to someone in particular, try to add "@name_of_the_person" in your message so he gets notified ;)
B
17
S
8
G
4
Posts: 461
Reputation: 6,097


Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS and 6 guests