How do I Detect collision with solid objects

Get help using Construct 2

Post » Fri Jun 30, 2017 7:47 pm

Hi

I'm using a solid object as a button to open a door in my game, button is solid and when the player collide with the button a door opens and an effect that I created would happen, however when the player collides with the button, the game detects multiple collisions with the button and creates multiple effects, but I only need one effect to be created when the player collides with the button. I made the button solid so the player can't go through it. Is there a solution to this issue?
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Fri Jun 30, 2017 8:11 pm

If only the effect is a problem you can add another condition to the event trigger once when true and it will only spawn once.

But this can get complicated for example if you have 3 buttons and 3 doors in a level, you will need to keep instance variable for each button with different value so you will know what button is pressed.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Fri Jun 30, 2017 9:10 pm

imhotep22 wrote:If only the effect is a problem you can add another condition to the event trigger once when true and it will only spawn once.

But this can get complicated for example if you have 3 buttons and 3 doors in a level, you will need to keep instance variable for each button with different value so you will know what button is pressed.

collision is a trigger itself, trigger once doesn't work with it
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Fri Jun 30, 2017 9:22 pm

Oh yeah I forgot about that, well you can limit it with a variable then. Add global variable lets say its called temp set it to 0 on start, and add extra condition on the event temp == 0, then as soon as the trigger fires in the first action set temp to 1, so its only triggered once.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Fri Jun 30, 2017 9:42 pm

imhotep22 wrote:Oh yeah I forgot about that, well you can limit it with a variable then. Add global variable lets say its called temp set it to 0 on start, and add extra condition on the event temp == 0, then as soon as the trigger fires in the first action set temp to 1, so its only triggered once.

Yeah I had this in my but it was conflicting with something else in the game, however I fixed the issue, thanks
B
45
S
19
G
3
Posts: 102
Reputation: 4,598


Return to How do I....?

Who is online

Users browsing this forum: corporatedrone, newt and 20 guests