Timer that follows margin

Get help using Construct 2

Post » Tue May 15, 2012 10:33 am

Hello,

How do I make a timer that counts up to measure time (score)
that follows the margin since i am making a platforming game.
How do I also make it reset everytime I click 'space' and pause when I touch a specific object?
Hobby app website: http://www.skymillapps.com/
B
10
S
2
Posts: 105
Reputation: 2,114

Post » Tue May 15, 2012 11:01 am

First make a layer for the timer, and set the parallax to 0 so that it will not move when the view does. Position your text where you want to show the time measure (score.) The dotted line represents the border of the players view, so use that to reference where you want the timer to always stay. Also add a "keyboard" object to your project so you can map the spacebar action later

In the event sheet make a variable "score". Make an event with a condition of every x seconds, and use the amount of seconds you want to pass before another point is added to the score. make another condition for the object to not be touching (overlapping) whatever object you want it to pause et. Make an action for your text box that will display the score and set it to "add to variable" action. Select the amount you want the score to change by with each second passed.
For instance,

every 1 second            | add +1 to "score"
is not overlapping object |

Make a second event that is "every tick", and give that an action using the text box you made for score set the text to "score".
for instance:
every tick | set text to "score"

make a third event with the keyboard condition "on pressed" and select spacebar as the button that should be pressed. give the event an action of setting the variable "score" to 0. This will make it so that whenever you press spacebar you will have the score reset to 0Greg2012-05-15 11:07:24
B
9
Posts: 59
Reputation: 997

Post » Sun May 20, 2012 9:06 am

I'm a little confused on the ' In the event sheet make a variable "score". Make an event with a condition of every x seconds, and use the amount of seconds you want to pass before another point is added to the score. part. When I go to the event sheet and add an event to the score, what event do i add to it?
Hobby app website: http://www.skymillapps.com/
B
10
S
2
Posts: 105
Reputation: 2,114

Post » Sun May 20, 2012 10:01 am

Make a variable "score"

Make an event. Give that event a system condition of "every x seconds." Set the amount of seconds will pass to the amount of time between adding to score. Give the event a system action "Add To Variable". Make it add to "score" and set the number it adds to how much you want it to go up by every time the event plays.

Whatever you set the time to for every x seconds, is how often it will add to score. Whatever you set the add to score value to will be how much it increases.

For instance, every second add 1 to score would make it add 1 to score each second that passes.


Here is an example of what I am talking about:

http://dl.dropbox.com/u/30187917/plaatforming_with_score.capxGreg2012-05-20 10:03:36
B
9
Posts: 59
Reputation: 997

Post » Mon May 21, 2012 10:31 am

Thanks, I got as far as putting the timer there and getting it to work and everything though I had one issue with adding the make a third event with the keyboard condition "on pressed" and select spacebar as the button that should be pressed. give the event an action of setting the variable "score" to 0. This will make it so that whenever you press spacebar you will have the score reset to 0. I cannot find any variable when I try to add the event.

Here's how far I got: http://dl.dropbox.com/u/75406771/timerattempt/konngam.capx
Hobby app website: http://www.skymillapps.com/
B
10
S
2
Posts: 105
Reputation: 2,114


Return to How do I....?

Who is online

Users browsing this forum: farfetchd83, makkancs and 25 guests