Jump to content

Update timer seconds value!


malav1410
 Share

Recommended Posts

In my game, i have a timer event which will run for 60 seconds.

This is a startGame function in coffeescript. Which has a time event in bold letters. I passed @seconds_counter value which is 60. So this timer will count till 60 seconds and afterthat calls @removeCounter function.

startGame: ->
    left_button = @add.button(60, 350, 'button', @checkAnswerForLeft, this)
    right_button = @add.button(460, 350, 'button', @checkAnswerForRight, this)
    @time.events.remove @timer
    # Start main game counter
    @seconds_timer = @time.events.loop(Phaser.Timer.SECOND, @updateSecondsCounter, this)

    @time.events.add Phaser.Timer.SECOND * @seconds_counter, @removeCounter, this

 

In my game i want to give users a time bonus in which i want to add extra seconds to this time event. I added 10 seconds to @seconds_counter  but it won't affect this timer event.

 

So in short, my game loop is 60 seconds. If user get time bonus then add 10 seconds to game loop so for that user gae will be of 70 seconds and after that @removeCounter function should call.

 

Is there any way to update time for running timer??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...