Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] My timer (not the default one) won't update!

Well, I've posted a few times before regarding a timer that I was creating to utilize in another script I was building, and finally got that finished and working perfectly. Now, I'm working on the main script to utilize it, and the timer has stopped updating. I'm not sure what's causing the problem, so I'll just post my script and the "working" sime script. (The thing is, it works when I hook it up to something other than my current script.)

Well, here's the timer I'm currently using. I know it's called a "subtimer", but that's because I have a second copy of that script already in use as "Weather_Timer".

Code:
class Weather_SubTimer
  
  def initialize
    @waiting = false
    @frames = 0
  end
  
  def update
    if @waiting == true
      if @frames <= 0
        @waiting = false
      else
        @frames -= 1
      end
    end
  end
  
  def start(seconds)
    @waiting = true
    @frames = seconds*40
  end
  
  def check
    if @waiting == false
      return true

    else
      return false
    end
  end
  
end

Well, I figured out my problem. I had accidentally had an "if variable = number" instead of "if variable == number". Silly me. Thanks for looking, though!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top