***Solved*** Count up timer triggers event.

Get help using Construct 2

Post » Sun Mar 02, 2014 2:49 pm

Hello great and powerful How do I forum. I have a question in my game at the end of a level I take the score and display it using a timer function to scroll it from zero to say a thousand depending on what you scored. As it's scrolling up the numbers I'd like to have it trigger an event. In other words when it hits the number 100 a bonus star is displayed. Any ideas?

Thanks in advance.
Last edited by dthomasdigital on Sun Mar 02, 2014 4:44 pm, edited 1 time in total.
B
25
S
10
G
3
Posts: 154
Reputation: 2,838

Post » Sun Mar 02, 2014 3:02 pm

Hello dthomasdigital;

There are a couple of ways to do this and below is how I would have done it.
Lets say you are showing the score in a textbox. Instead of directly manipulating the textbox objects text propoerty, first I advice to create a global variable named "ShowScore" and tie the timer function to it as you have already done with your current score display system.

Then change textbox objects text property to ShowScore every tick
Then do

run once while true
score >= scorelimit1
starsprite visible

you can add additional score limits too.

But if by scrolling you mean you have a sprite that has all the possible scores displayed on it and you are scrolling the sprite slowly, you will have to find the distances and make some mathematical function to calculate which score it's showing based on how much it has moved from it's starting position. For that kind of thing, community would need a proejct file to be able to help I think.

Hope this helps.
B
17
S
4
G
1
Posts: 332
Reputation: 3,099

Post » Sun Mar 02, 2014 4:43 pm

Your solution worked perfectly, thank you very much.
B
25
S
10
G
3
Posts: 154
Reputation: 2,838


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests