How do I make a proper Score that adds difficulty

Just started using Construct 2? Post your questions here

Post » Fri May 01, 2015 9:37 pm

Hi Guys...

Me again... i'm so sorry for asking so many questions on this forum i hope i don't get on anybodys nerves and that in the coming weeks i'll get quieter except when i have a new Game to show...

But... well it's kinda frustrating, this was supposed to be my first simple Game that nobody will see and yet everytime i'll try to add the simplest of things i get a new strange bug that i can't make out. I did like four video tutorial series and read through the manual as well as two books before even attempting this thing so i hope it's okay that i ask...

Basically, all i want to do is add a Score to each time the Player kills one of the Mosquitos in my Game and then add some difficulty by subtracting values from Global Variables. Sounds easy enough right? Well, i made a function that subtracts a certain value of each of the Variables. Yet here's the very strange thing that happens as soon as i call it:

The Game basically plays like this: you switch off the light, the mosquito is coming in, a sprite triggers it that it sits on your nose. Then a Timer starts and within that timeframe you have to turn the lights back on to catch it sitting on your nose. If you wait too long, it will sting and kill you :D

It all worked perfectly, but ever since i tried to add the score, this happens:

The "victory" animation plays, the layer restarts, and then, when you turn off the light again, it immediately turns back on and plays the death frame... As if the timer wouldn't stop in the background or something and as soon as it reckognizes the light being turned on it does what it's supposed to do, play the death animation, since the timer is expired. Yet i stop the timer as you can see in my event sheet and it all works great if i disable the function calling. I just don't know how this could affect anything. The timer calls a global variable as a duration, which would make it possible to make the game a bit harder by giving the player less time to react as soon as the buzzing stops and the mosquito is dangerously close.

I love how helpful people are in here, yet i don't want to waste anyone's time and come off as trying to get somebody to make that game for me. Yet i'm really kind of stuck and any help is as always greatly appreciated, even if it's just a hint.

Thanks so much!

CAPX: https://drive.google.com/file/d/0Bwu0b_8ZTavBR0dSUnhqUm9uaWs/view?usp=sharing


Image
B
15
S
5
G
1
Posts: 85
Reputation: 1,222

Post » Fri May 01, 2015 9:50 pm

You Score events are going to be called constantly (once it reached 1). Dump them, and call AddDificulty right after "Add 1 to Score". Then it's called once when needed.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri May 01, 2015 9:53 pm

Aaaaaaaah!!! *facepalm*

Makes sense! Ill try that first thing in the morning! Thanks so much :)
B
15
S
5
G
1
Posts: 85
Reputation: 1,222


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests