Help A Noob

Get help using Construct 2

Post » 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.

Thanks in advance!
B
3
Posts: 6
Reputation: 337

Post » 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
Add 10 point to "score"

If your character overlaping 'Rings' and "second" large then 21
Add 50 point to "score"

If your character overlaping 'Rings' and "second" large then 31
Add 10 point to "score"

And so on...

Hope it'll help you, if i understand what you mean :D, i'm bad at English.
farsmile902012-10-04 10:54:05
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » 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
      - (your events for adding 50 points to score)
sub + 50PtsToggle is false
      - (your events for adding 10 points to score)

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

Post » 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

Post » 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 R238 for all examples
B
60
S
17
G
6
Posts: 363
Reputation: 9,125

Post » 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

Post » Thu Oct 04, 2012 5:14 pm

you can download r105 here

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

Post » Thu Oct 04, 2012 5:15 pm

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

you can download it hereLobo932012-10-04 17:16:08
B
7
S
2
G
1
Posts: 32
Reputation: 1,089

Post » 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

Post » 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 R238 for all examples
B
60
S
17
G
6
Posts: 363
Reputation: 9,125

Next

Return to How do I....?

Who is online

Users browsing this forum: ggman, MarkThomas, theosciandra and 16 guests