How do I fix this colission issue?

Get help using Construct 2

Post » Sun Sep 11, 2016 5:23 pm

Hi,

So I have the player set to mouse.x and mouse.y, and when he touches the walls, 1 life should be lost and the game should restart.

What is happening, is that the game is subtracting all 5 lifes at once. I've tried to set up a variable, destroy the player sprite, the "trigger once when true" event, set up a function, so the game doesn't count more than once the collision. I think the game is counting a collsion per tick, therefore all the lifes are being lost.

Game file:
https://dl.dropboxusercontent.com/u/200 ... issue.capx

(lvl1 layout, lvlsheet, line 11)

Thanks!
B
25
S
8
Posts: 81
Reputation: 1,691

Post » Sun Sep 11, 2016 6:11 pm

What is this mail plugin? Can you delete that and re-upload the capx, thanks
B
45
S
15
G
73
Posts: 2,008
Reputation: 43,398

Post » Sun Sep 11, 2016 7:00 pm

plinkie wrote:What is this mail plugin? Can you delete that and re-upload the capx, thanks

Sorry:

https://dl.dropboxusercontent.com/u/200 ... 0ver2.capx
B
25
S
8
Posts: 81
Reputation: 1,691

Post » Sun Sep 11, 2016 7:29 pm

Image

that fixed it, it was still on the mouse so obviously it was going back to the start then to the mouse position before the screen was redrawn so the on colission triggered over and over.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sun Sep 11, 2016 7:31 pm

It's because when lives is greater than 0 you restart the layout but on restarting the layout it sets the player position to mouse.x, mouse.y which is already overlapping the gameender. edit:Yeah somebody already posted.
B
45
S
15
G
73
Posts: 2,008
Reputation: 43,398

Post » Sun Sep 11, 2016 9:15 pm

You guys are great!, thank you!
B
25
S
8
Posts: 81
Reputation: 1,691


Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher, marcoscodas and 7 guests