# Help A Noob

Get help using Construct 2

### » Thu Oct 04, 2012 7:00 am

Hello all, I'm working on my first project in Construct 2, & I have hit a wall. In fact, I've been banging my head on said wall long enough to have the epiphany of bringing my question here.

Here goes... How can I assign different Point values for sprites based on CurrentTime?

Example: Object of game is to collect rings. Rings are worth 10 points for first 20 seconds then are worth 50 points from 21-30 seconds, then back to 10 points for another duration, and so on.

ANY help would be very much appreciated. I've spent quite a bit of time searching these forums the past couple of days, and you all seem to be pretty helpful.

B
3
Posts: 6
Reputation: 337

### » Thu Oct 04, 2012 10:51 am

okay.
creat global variable called " second"
creat global variable called " score "

Every 1 second > add to 1 'second"

If your character overlaping 'Rings' and "second" Small or = 20

If your character overlaping 'Rings' and "second" large then 21

If your character overlaping 'Rings' and "second" large then 31

And so on...

farsmile902012-10-04 10:54:05
B
50
S
12
G
8
Posts: 259
Reputation: 10,881

### » Thu Oct 04, 2012 12:06 pm

@farsmile90 That doesn't really take into consideration escalation though.

@42t I suggest doing something like this.

Since the duration for the different point values are different, 20 seconds for 10 points and 10 seconds for 50 points, an every x seconds toggle wont do.

Make 2 global variables "50PtsDuration" and "10PtsDuration", and make 1 boolean "50PtsToggle".

What you wanna do with these is use them as separate timers and instead of counting up, we count down.

+ Start of Layout
- Set variable "10PtsDuration" to 20
- Set boolean "50PtsToggle" to false

+ Every 1.0 Second
- Subtract 1 from variable "10PtsDuration"
- Subtract 1 from variable "50PtsDuration"

+ Variable "10PtsDuration" is lower, or equal to, 0
- Set variable "50PtsDuration" to 10
- Set boolean "50PtsToggle" to true

+ Variable "50PtsDuration" is lower, or equal to, 0
- Set variable "10PtsDuration" to 20
- Set boolean "50PtsToggle" to false

+ (your events for picking up rings)
sub + 50PtsToggle is true
sub + 50PtsToggle is false

Essentially when one timer reaches zero it restarts the other timer, and we don't have to count the actual seconds.

You could do this without the boolean and just use "'10/50PtsDuration' is greater than 0", but I personally think using the boolean makes it a bit cleaner.inkBot2012-10-04 12:09:57
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

### » Thu Oct 04, 2012 4:09 pm

Thanks so much for the responses! I'm going to give those methods a shot in a couple of hours. Again, thanks for the advice.
B
3
Posts: 6
Reputation: 337

### » Thu Oct 04, 2012 4:32 pm

Just had a go at making it, is this what you were after ?

https://dl.dropbox.com/u/108799982/TogglePoints.capx

*Note : For the first 5 seconds nothing happens*
Using R248 for all examples
B
70
S
21
G
6
Posts: 382
Reputation: 9,812

### » Thu Oct 04, 2012 5:11 pm

Hey Emoaden, thanks for responding. It seems you have a newer version of Construct than I.

It seems you have 105, but all I can find is 103.2 :(

I'm guessing 105 must be the Pro version of Construct 2?
B
3
Posts: 6
Reputation: 337

### » Thu Oct 04, 2012 5:14 pm

https://www.scirra.com/construct2/releases/r105
B
50
S
12
G
8
Posts: 259
Reputation: 10,881

### » Thu Oct 04, 2012 5:15 pm

nope, it's just beta, but it's free

B
7
S
2
G
1
Posts: 32
Reputation: 1,089

### » Thu Oct 04, 2012 5:18 pm

Awesome, thanks guys! Going to try this , & InkBots suggestion right now.

EDIT: Emoaeden, that's pretty much what I was trying to figure out. Thank you for sharing that, looking at it in the Event Editor is a major help.

What would I add to make that Toggle occur only once? Also, I'd like it to happen at different times with different instances of the same sprite.

I know that I could just clone the sprite for each time I want it to happen, and add that System - Every X Seconds - Sprite - Toggle Bonus event, but wouldn't that bog the game down? Could I just use Instance Variables somehow, and add an event for each sprite with a unique IV?

I can't thank you all enough for your input, it seems this forum is full of smart/helpful people.

EDIT: I forgot to mention I'm using an HHMMSS counter counting up from Zero. Used the tutorial here (http://www.scirra.com/tutorials/173/time-counter/page-1).42t2012-10-04 18:03:19
B
3
Posts: 6
Reputation: 337

### » Fri Oct 05, 2012 5:17 am

Hang on, when you say once at different times with different instances what do you mean exactly ?
Using R248 for all examples
B
70
S
21
G
6
Posts: 382
Reputation: 9,812

Next