0 Favourites

Help A Noob

  • 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!

  • 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.

  • 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.

  • 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.

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

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

    *Note : For the first 5 seconds nothing happens*

  • 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?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • nope, it's just beta, but it's free <img src="smileys/smiley1.gif" border="0" align="middle">

    you can download it here

  • 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).

  • Hang on, when you say once at different times with different instances what do you mean exactly ?

  • Okay, using the ring example, say I have 3 different colored rings, red, green, and blue.

    I want one of the Red rings to be worth more than the Blue, & Green, but only for a couple of seconds at, say, 00:01:30.

    Using your example, and since the specific object would only be on the screen for a short time (scrolling background) , I can do this.

    But instead of ALL Red rings being worth X points For X seconds After X seconds, I would like only 1 Clone of the Red ring object to be.

    I meant different Clones of the same object when I said Instances, sorry for the confusion. My bad <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Instances is the right word to use, I think what he meant was that your sentence structure was a bit confusing.

    To only apply the duration/effect to one ring at a time you'll want to use the System condition "Pick Random Instance" (or "Pick Nth Instance", if you need/want to be specific with which one is changed) together with the events for the timers, then have a boolean for the ring sprite be true for the duration and use that to detect if the player picks up a ring and if it has that boolean active. If true, add the extra points, if false just add normal points.

  • Thanks so much guys, you saved my day.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)