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.

Panorama animation problem...

I scripted this little definition for Spriteset_Map a while ago, and it isn't working for some strange reasons I can't tell... the panorama just stays at Water-01...

Code:
  def update_panorama
    if @panorama_name == "Water-01"
      @panorama.bitmap = RPG::Cache.panorama("Water-02", @panorama_hue)
    elsif @panorama_name == "Water-02"
      @panorama.bitmap = RPG::Cache.panorama("Water-03", @panorama_hue)
    elsif @panorama_name == "Water-03"
      @panorama.bitmap = RPG::Cache.panorama("Water-04", @panorama_hue)
    elsif @panorama_name == "Water-04"
      @panorama.bitmap = RPG::Cache.panorama("Water-01", @panorama_hue)
    end
  end

The update_panorama call is inside the first conditional of update definition, just if that matters...

Code:
def update
    update_panorama
    if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue
      @panorama_name = $game_map.panorama_name
      @panorama_hue = $game_map.panorama_hue
      if @panorama.bitmap != nil
        @panorama.bitmap.dispose
        @panorama.bitmap = nil
      end
      Graphics.frame_reset
    end
    # [...]
  end

Thanks in advance.
 
Try out this:
Code:
def update_panorama
    if @panorama_name == "Water-01"
      $game_map.panorama_name = Water-02
    elsif @panorama_name == "Water-02"
      $game_map.panorama_name = "Water-03"
    elsif @panorama_name == "Water-03"
      $game_map.panorama_name = "Water-04"
    elsif @panorama_name == "Water-04"
      $game_map.panorama_name = "Water-01"
    end
  end
 
Code:
  def update_panorama
    @count += 1
    base = 8
    if @count == base
      $game_map.panorama_name = "Water-02"
    elsif @count == base * 2
      $game_map.panorama_name = "Water-03"
    elsif @count == base * 3
      $game_map.panorama_name = "Water-04"
    elsif @count == base * 4
      $game_map.panorama_name = "Water-01"
      @count = 0
    end
  end
 
Try this:
Code:
  def update_panorama
    @count = (@count + 1) % 8
    return if @count != 0
    if @panorama_name == "Water-01"
      $game_map.panorama_name = Water-02
    elsif @panorama_name == "Water-02"
      $game_map.panorama_name = "Water-03"
    elsif @panorama_name == "Water-03"
      $game_map.panorama_name = "Water-04"
    elsif @panorama_name == "Water-04"
      $game_map.panorama_name = "Water-01"
    end
  end
 
This is the latest code I got to... the problem is that the variable @count only gets updated (increased) once for some reason...

Code:
  def update_panorama
    @count += 1
    base = 8
    if @count == base
      $game_map.panorama_name = "Water-02"
    elsif @count == base * 2
      $game_map.panorama_name = "Water-03"
    elsif @count == base * 3
      $game_map.panorama_name = "Water-04"
    elsif @count == base * 4
      $game_map.panorama_name = "Water-01"
      @count = 0
    end
  end
 
(This is SephirothSpawn on my little brothers account)

I am currently finishing up a multiple and animated panoramas, fogs and weather system. It allows animated panorams and fogs using my quick animations script which I updated drastically, to work with both sprites and planes (which is what panoramas and fogs use).

You will setup a Game_MultiPanorama, which will include attributes for coordinate changes, opacity change speed, etc.

Anyways, if you are wanting to do it your way, I suggest this:

Code:
class Game_Map
  alias seph_animpan_gmap_init initialize
  alias seph_animpan_gmap_update update
  def initialize
    @anim_pan_count = 0
    seph_animpan_gmap_init
  end
  def update
    seph_animpan_gmap_update
    @anim_pan_count += 1
    @anim_pan_count %= frames
    if @anim_pan_count == 0
      if @panorama_name == 'X'
        @panorama_name == 'Y'
      elsif ...
      ...
      end
    end
  end
end

I don't have rmxp here to refrence or test it, but it should work. ^_^
 
It doesn't... same result as my own try, it just stays at Water-01... here's what I have:

Code:
class Game_Map
  #--------------------------------------------------------------------------
  alias panorama_anim_init initialize
  def initialize
    @anim_pan_count = 0
    panorama_anim_init
  end
  #--------------------------------------------------------------------------
  alias panorama_anim_update update
  def update
    panorama_anim_update
    @anim_pan_count += 1
    @anim_pan_count %= 4
    if @anim_pan_count == 0
      if @panorama_name == 'Water-01'
        @panorama_name == 'Water-02'
      elsif @panorama_name == 'Water-02'
        @panorama_name == 'Water-03'
      elsif @panorama_name == 'Water-03'
        @panorama_name == 'Water-04'
      elsif @panorama_name == 'Water-04'
        @panorama_name == 'Water-01'
      end
    end
  end
  #--------------------------------------------------------------------------
end

Did I make some dizzy error in there? ^_^'
 
Code:
class Game_Map
  #--------------------------------------------------------------------------
  alias panorama_anim_init initialize
  def initialize
    @anim_pan_count = 0
    panorama_anim_init
  end
  #--------------------------------------------------------------------------
  alias panorama_anim_update update
  def update
    panorama_anim_update
    @anim_pan_count += 1
    @anim_pan_count %= 4
    if @anim_pan_count == 0
      if @panorama_name == 'Water-01'
        @panorama_name [color=Red]==[/color] 'Water-02'
      elsif @panorama_name == 'Water-02'
        @panorama_name [color=Red]==[/color] 'Water-03'
      elsif @panorama_name == 'Water-03'
        @panorama_name [color=Red]==[/color] 'Water-04'
      elsif @panorama_name == 'Water-04'
        @panorama_name [color=Red]==[/color] 'Water-01'
      end
    end
  end
  #--------------------------------------------------------------------------
end

Look at the red marked points, it should be only one "="
 
Damn... this is what you get if you blindly trust Seph :P

Anyway, it works with the corrected operators... it's just a bit laggy (takes away about 10 fps)... well, I run about ten programs right now, so that might be it, but just in case someone gets an idea on how to make that lag-proof :p
 
I just about finished my animated fogs and panoramas, and there is no virtual lag I have noticed.

I will try to finish it before I post my test bed in the next day or so. I am done with everything except commenting a few things and instructions.
 

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