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.

Tone Change by Frame

OS

Sponsor

Hello, again! I need a little bit of help fixing my Tone Method. It is supposed to change the tone of a map based on a given weather effect.

Here is the method:

Code:
def fix_tone
    return if !@tone_fix
    for i in 0..@btone.size - 1
      @ntone[i] = @btone[i] + OS::W_Tones[@type]
    end
    tone = Tone.new(@ntone[0],@ntone[1],@ntone[2],@ntone[3])
    $game_screen.start_tone_change(tone, 10)
    return
  end

As you can see, this method should only do something if @tone_fix is true. Instead of doing what it is told, this method adds -10 (OS::W_Tones[@type] is always -10 in the test) to the base tone (@btone) every frame. This makes the screen go black in about a second and a half. All of the values in array @btone are the red,green,blue,gray values of the default tone respectively.

What is wrong with it? Ive made various edits to the method itself as well as the rest of the script. Nothing changes but the speed at which the damn thing goes black. One attempt to fix this led to no changes in tone at all. Help is much appreciated, thanks.
 
Try this:
Code:
def fix_tone
    return if ! @tone_fix
    for i in 0..@btone.size - 1
      @ntone[i] = @btone[i] + OS::W_Tones[@type]
    end
    tone = Tone.new(@ntone[0],@ntone[1],@ntone[2],@ntone[3])
    $game_screen.start_tone_change(tone, 10)
    @tone_fix = false
  end
 

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