How do I set the score

Get help using Construct 2

Post » Mon Mar 13, 2017 8:58 pm

in my game theres a ball bouncing and i want everytime i colide with the ball it bounces away and i get 1 point. did it like this. "me > on collision with > ball> value add 1 to score" but the problem is that somethimes i collide with the ball and push it away and meanwhile im pushing the ball the score goes crazy, like hundreds of points, because they are still in touch.
how can i tell my game not to score hundred of points when i collide and collision is still happening but only 1 point?
i dont want to put something like wait x seconds because sometimes it's not just a brief moment that i'm pushing the ball, and also e.g. if i got wait 0.5 seconds and i hit the ball after 0.3, i would not be givven that point
B
5
Posts: 31
Reputation: 291

Post » Mon Mar 13, 2017 9:59 pm

Turn off the ball colission for a short time or use a different scoring system.

If you score on collision then it will score every collision unless you turn off collisions.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Mon Mar 13, 2017 10:02 pm

lamar wrote:Turn off the ball colission for a short time or use a different scoring system.

If you score on collision then it will score every collision unless you turn off collisions.

no other way to do this comes to mind?
B
5
Posts: 31
Reputation: 291

Post » Mon Mar 13, 2017 10:32 pm

JohnnyBeGood wrote:
lamar wrote:Turn off the ball colission for a short time or use a different scoring system.

If you score on collision then it will score every collision unless you turn off collisions.

no other way to do this comes to mind?


Not if you are using collisions for scoring.

You can change the game so the player has to go touch a wall or a spot before hitting the ball or the ball has to hit a wall or something before another score is registered.

Make it harder to get a score.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Tue Mar 14, 2017 1:59 am

ball on collision with object wait 0.01 add score 1

make sure the scoring is at the bottom of the entire event system, so the wait wont affect other events.
B
70
S
20
G
67
Posts: 1,311
Reputation: 42,293

Post » Tue Mar 14, 2017 4:11 am

I would use a value to track contact

Like on contact,
[
if 'touching' = 0, score+=1
touching=2
]

If touching >0, touching -=1


That way the contact is continually renewed and wont allow a new score addition until contact breaks and 2 ticks have occurred (which is usually a tiny, tiny amount of time)

Good luck!
B
50
S
14
G
4
Posts: 187
Reputation: 5,499


Return to How do I....?

Who is online

Users browsing this forum: BadMario, istero, mr32D, mtnboy22 and 1 guest