Need help trying to make an animated background for a custom menu.

Started by Zephor, November 06, 2011, 02:45:42 pm

Previous topic - Next topic

Zephor

Pretty much like Moghunters custom menu. I've been studying his script but I can't seem to figure out how he got his background to move like that. I'm sure it's pretty simple.

Spoiler: ShowHide
#==============================================================================
# ** MOG Scene Menu Itigo V1.5
#     By Moghunter  
#     http://www.atelier-rgss.com
#------------------------------------------------------------------------------
# ** Reinvisioned version
#    
#    This variant has retooled the MOG module by adding more configurables for
#    the user.  No longer are the graphics hardwired into the code but are now
#    able to be altered in the revised configuration serction.
#
#    Also, certain classes have been renamed  back to their original versions.
#    As such...  classes such as Window_Gold2 and Window_MenuStatus2 have been
#    renamed back to Window_Gold and Window_MenuStatus. This change within the
#    script also allowed for the deletion of unnecessary and redundant methods
#    within the script:
#
#    Classes and methods renamed:
#    * Window_MenuStatus2
#    * Window_Gold2    
#    * Window_PlayTime2
#    * Window_Steps2    
#    * draw_actor_state2 (in the Window_Base class)
#
#    Methods deleted from the original system:
#    * refresh    (Window_Gold)
#    * update     (Window_Playtime)
#    * initialize (Scene_Menu)
#==============================================================================


module MOG

 # BASIC MENU CONFIGURATION
   # Main Menu Graphics Used
     MAIN_LAYOUT       = "Layout-Menu"     # Main Menu Graphics
     MAIN_BACKGROUND   = "Back-Menu"       # Animated background graphic
     MAIN_CURSOR       = "MogCursor"       # Animated cursor graphic
     MAIN_CURSOR_FX    = false             # Animated cursor fx on/off switch
     SECOND_CURSOR     = "MogCursor_2"     # Animated secondary cursor graphic
     SECOND_CURSOR_FX  = false             # Animated second cursor fx
     FACE_SMALL        = "_Fs"             # Suffix for face graphics (small)
     MAIN_MAPNAME      = true              # If true, shows the map name
   # Menu
     MAIN_FX           = 0                 # Back FX (0=Moving/ 1=Still/ 2=Map)
     MAIN_TRAN_TIME    = 20                # Transition Time.
     MAIN_TRAN_TYPE    = "006-Stripe02"    # Transition Type (Name)
   # Font Used
     MAIN_FONT         = "Georgia"         # Font used in Main Menu
 
 # MENU GAUGE GRAPHICS
   # Empty Bars
     MAIN_BAR_E        = "BAR0"            # Blank bar
     MAIN_BAR_XP_E     = "Exp_Back"        # Blank bar for EXP
   # Fill Bars
     MAIN_BAR_HP       = "HP_Bar"          # Fill bar for HP
     MAIN_BAR_SP       = "SP_Bar"          # Fill bar for SP
     MAIN_BAR_XP       = "Exp_Meter"       # Fill bar for EXP
   # Gauge Texts
     MAIN_TEXT_HP      = "HP_Tx"           # Text graphic for HP
     MAIN_TEXT_SP      = "SP_Tx"           # Text graphic for SP
     MAIN_TEXT_XP      = "Exp_tx"          # Text graphic for EXP
     MAIN_TEXT_LV      = "LV_tx"           # Text graphic for Level
 
end

# Mogscript global
$mogscript = {} if $mogscript == nil
$mogscript["menu_itigo"] = true



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
 def now_exp
 #--------------------------------------------------------------------------
 # * Get EXP
 #--------------------------------------------------------------------------    
   return @exp - @exp_list[@level]
 end
 #--------------------------------------------------------------------------
 # * Get Next Level EXP
 #--------------------------------------------------------------------------
 def next_exp
   return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
 end
end



#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :map_id                   # map id
 #--------------------------------------------------------------------------
 # * Map Name
 #--------------------------------------------------------------------------  
 def mpname
   $mpname = load_data("Data/MapInfos.rxdata")
   $mpname[@map_id].name
 end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
 #--------------------------------------------------------------------------
 # * Draw Empty Face
 #--------------------------------------------------------------------------  
 def nada
   face = RPG::Cache.picture("")
 end    
 #--------------------------------------------------------------------------
 # * Draw Face
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------  
 def drw_face(actor, x, y)
   face = RPG::Cache.picture(actor.name + MOG::FACE_SMALL) rescue nada
   cw = face.width
   ch = face.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x , y - ch, face, src_rect)    
 end  
 #--------------------------------------------------------------------------
 # * Draw HP from Image
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------  
 def draw_maphp3(actor, x, y)
   back = RPG::Cache.picture(MOG::MAIN_BAR_E)
   cw = back.width  
   ch = back.height
   src_rect = Rect.new(0, 0, cw, ch)    
   self.contents.blt(x + 65, y - ch + 30, back, src_rect)
   meter = RPG::Cache.picture(MOG::MAIN_BAR_HP)
   cw = meter.width  * actor.hp / actor.maxhp
   ch = meter.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
   text = RPG::Cache.picture(MOG::MAIN_TEXT_HP)
   cw = text.width  
   ch = text.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 35, y - ch + 30, text, src_rect)
   self.contents.font.color = Color.new(0, 0, 0, 255)
   self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)
   self.contents.font.color = Color.new(255, 255, 255, 255)
   self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)    
 end  
 #--------------------------------------------------------------------------
 # * Draw SP from Image
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------
 def draw_mapsp3(actor, x, y)
   back = RPG::Cache.picture(MOG::MAIN_BAR_E)
   cw = back.width  
   ch = back.height
   src_rect = Rect.new(0, 0, cw, ch)    
   self.contents.blt(x + 65, y - ch + 30, back, src_rect)
   meter = RPG::Cache.picture(MOG::MAIN_BAR_SP)    
   cw = meter.width  * actor.sp / actor.maxsp
   ch = meter.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
   text = RPG::Cache.picture(MOG::MAIN_TEXT_SP)
   cw = text.width  
   ch = text.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 35, y - ch + 30, text, src_rect)
   self.contents.font.color = Color.new(0, 0, 0, 255)
   self.contents.draw_text(x + 81, y - 1, 48, 32, actor.sp.to_s, 2)
   self.contents.font.color = Color.new(255, 255, 255, 255)
   self.contents.draw_text(x + 80, y - 2, 48, 32, actor.sp.to_s, 2)    
 end  
 #--------------------------------------------------------------------------
 # * Draw EXP from Image
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------
 def draw_mexp2(actor, x, y)
   bitmap2 = RPG::Cache.picture(MOG::MAIN_BAR_XP_E)
   cw = bitmap2.width
   ch = bitmap2.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 60 , y - ch + 30, bitmap2, src_rect)
   if actor.next_exp != 0
     rate = actor.now_exp.to_f / actor.next_exp
   else
     rate = 1
   end
   bitmap = RPG::Cache.picture(MOG::MAIN_BAR_XP)
   if actor.level < 99
     cw = bitmap.width * rate
   else
     cw = bitmap.width
   end  
   ch = bitmap.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 60 , y - ch + 30, bitmap, src_rect)
   exp_tx = RPG::Cache.picture(MOG::MAIN_TEXT_XP)
   cw = exp_tx.width
   ch = exp_tx.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 55 , y - ch + 30, exp_tx, src_rect)
   lv_tx = RPG::Cache.picture(MOG::MAIN_TEXT_LV)
   cw = lv_tx.width
   ch = lv_tx.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x + 125 , y - ch + 35, lv_tx, src_rect)
   self.contents.font.color = Color.new(0, 0, 0, 255)
   self.contents.draw_text(x + 161, y + 7, 24, 32, actor.level.to_s, 1)
   self.contents.font.color = Color.new(255, 255, 255, 255)
   self.contents.draw_text(x + 160, y + 6, 24, 32, actor.level.to_s, 1)
 end
 #--------------------------------------------------------------------------
 # * Draw State
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_state(actor, x, y, width = 80)
   text = make_battler_state_text(actor, width, true)
   self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
   self.contents.draw_text(x, y, width, 32, text, 2)
 end  
end



#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------  
 def initialize
   super(0, 0, 415, 280)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.windowskin = RPG::Cache.windowskin("")
   self.opacity = 0
   self.z = 15
   refresh
   self.active = false
   self.index = -1
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------  
 def refresh
   self.contents.clear
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     x = 20
     y = i * 62
     actor = $game_party.actors[i]
     self.contents.font.name = MOG::MAIN_FONT
     if $mogscript["TP_System"] == true
       draw_actor_tp(actor, x + 285, y - 5, 4)  
       draw_actor_state(actor, x + 190, y - 5)
     else  
       draw_actor_state(actor, x + 220, y - 5)
     end
     drw_face(actor, x, y + 50)
     draw_maphp3(actor, x + 40, y - 5)
     draw_mapsp3(actor, x + 40, y + 20)
     draw_mexp2(actor, x + 140, y + 15)
   end
 end
 #--------------------------------------------------------------------------
 # * Cursor Rectangle Update
 #--------------------------------------------------------------------------
 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
   else
     self.cursor_rect.set(5, @index * 62, self.width - 32, 50)
   end
 end
end



#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.windowskin = RPG::Cache.windowskin("")
   self.opacity = 0
   self.z = 15
   refresh
 end
end



#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
#  This window displays play time on the menu screen.
#==============================================================================

class Window_PlayTime < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.windowskin = RPG::Cache.windowskin("")
   self.opacity = 0
   self.z = 15
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   @total_sec = Graphics.frame_count / Graphics.frame_rate
   hour = @total_sec / 60 / 60
   min = @total_sec / 60 % 60
   sec = @total_sec % 60
   text = sprintf("%02d:%02d:%02d", hour, min, sec)
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 32, 120, 32, text, 2)
 end
end

#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
#  This window displays step count on the menu screen.
#==============================================================================

class Window_Steps < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.windowskin = RPG::Cache.windowskin("")
   self.opacity = 0
   self.z = 15
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
 end
end



#==============================================================================
# ** Window_Map_Name
#------------------------------------------------------------------------------
#  This window displays the map name on the menu screen.
#==============================================================================

class Window_Map_Name < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.windowskin = RPG::Cache.windowskin("")
   self.opacity = 0
   self.z = 15
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 32, 120, 32, $game_map.mpname.to_s, 1)
 end
end



#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   s1 = ""
   s2 = ""
   s3 = ""
   s4 = ""
   s5 = ""
   s6 = ""
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
   @command_window.index = @menu_index
   if $game_party.actors.size == 0
     @command_window.disable_item(0)
     @command_window.disable_item(1)
     @command_window.disable_item(2)
     @command_window.disable_item(3)
   end
   @command_window.visible = false
   @command_window.x = -640
   @mnlay = Sprite.new
   @mnlay.bitmap = RPG::Cache.picture(MOG::MAIN_LAYOUT)
   @mnlay.z = 10
   @mnlay.opacity = 0
   @mnlay.x = -100
   if MOG::MAIN_FX == 0
     @mnback = Plane.new
     @mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
     @mnback.blend_type = 0
     @mnback.z = 5
     @mnback2 = Plane.new
     @mnback2.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
     @mnback2.blend_type = 0
     @mnback2.z = 5
     @mnback2.opacity = 60
   elsif MOG::MAIN_FX == 1
     @mnback = Plane.new
     @mnback.bitmap = RPG::Cache.picture(MOG::MAIN_BACKGROUND)
     @mnback.blend_type = 0
     @mnback.z = 5
   else
     @spriteset = Spriteset_Map.new
   end
   @mnsel = Sprite.new
   @mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)
   @mnsel.z = 20
   @mnsel.x = 0
   @mnsel.y = 110
   @mnop = 150
   if $game_system.save_disabled
     @command_window.disable_item(4)
   end
   @playtime_window = Window_PlayTime.new
   @playtime_window.x = 30
   @playtime_window.y = 375
   @playtime_window.contents_opacity = 0
   if MOG::MAIN_MAPNAME == true
     @mapname_window = Window_Map_Name.new
     @mapname_window.x = 425
     @mapname_window.y = 25
     @mapname_window.contents_opacity = 0
   end
   @steps_window = Window_Steps.new
   @steps_window.x = 230
   @steps_window.y = 375
   @steps_window.contents_opacity = 0
   @gold_window = Window_Gold.new
   @gold_window.x = 455
   @gold_window.y = 405
   @gold_window.contents_opacity = 0
   @status_window = Window_MenuStatus.new
   @status_window.x = 295
   @status_window.y = 110
   @status_window.contents_opacity = 0
   if MOG::MAIN_FX == 0
     Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
       MOG::MAIN_TRAN_TYPE)
   elsif MOG::MAIN_FX == 1
     Graphics.transition(MOG::MAIN_TRAN_TIME, "Graphics/Transitions/" +
       MOG::MAIN_TRAN_TYPE)
   else
     Graphics.transition  
   end
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   for i in 0..10  
     if MOG::MAIN_FX == 0
       @mnback.oy += 1
       @mnback.ox += 1
       @mnback2.oy += 1
       @mnback2.ox -= 1
     end
     @status_window.x += 20
     @status_window.contents_opacity -= 25
     @mnsel.opacity -= 25
     @mnsel.zoom_x += 0.03
     @mnlay.x -= 10
     @mnlay.opacity -= 25
     if MOG::MAIN_MAPNAME == true
       @mapname_window.x += 5
       @mapname_window.contents_opacity -= 20
     end
     @steps_window.contents_opacity -= 25
     @gold_window.contents_opacity -= 25
     @playtime_window.contents_opacity -= 25
     Graphics.update  
   end
   Graphics.freeze
   @command_window.dispose
   @playtime_window.dispose
   @steps_window.dispose
   @gold_window.dispose    
   @status_window.dispose
   @mnlay.dispose
   if MOG::MAIN_FX == 0
     @mnback.dispose
     @mnback2.dispose
   elsif MOG::MAIN_FX == 1
     @mnback.dispose
   else
     @spriteset.dispose
   end
   @mnsel.dispose
   @mapname_window.dispose if MOG::MAIN_MAPNAME == true
   Graphics.update
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   if MOG::MAIN_CURSOR_FX
     if @mnsel.zoom_x <= 1.6
       @mnsel.zoom_x += 0.03
       @mnsel.opacity -= 10
     elsif @mnsel.zoom_x > 1.6
       @mnsel.zoom_x = 1.0
       @mnsel.opacity = 255
     end    
   end
   if @mnlay.x < 0
     @mnlay.opacity += 25
     @mnlay.x += 10
   elsif @mnlay.x >= 0  
     @mnlay.opacity = 255
     @mnlay.x = 0
   end
   @command_window.update if @command_window.active
   @playtime_window.update
   @status_window.update if @status_window.active
   if MOG::MAIN_FX == 0
     @mnback.oy += 1
     @mnback.ox += 1
     @mnback2.oy += 1
     @mnback2.ox -= 1
   end
   @mnop += 5
   # Secondary Cursor
   if @command_window.active == true
     @mnsel.bitmap = RPG::Cache.picture(MOG::MAIN_CURSOR)    
   else
     @mnsel.bitmap = RPG::Cache.picture(MOG::SECOND_CURSOR)
     unless MOG::SECOND_CURSOR_FX
       @mnsel.zoom_x = 1
       @mnsel.opacity = 255
     end
   end
   @mapname_window.contents_opacity += 15 if MOG::MAIN_MAPNAME == true
   @playtime_window.contents_opacity += 15
   @gold_window.contents_opacity += 15
   @playtime_window.contents_opacity += 15
   @steps_window.contents_opacity += 15
   if @status_window.x > 195
     @status_window.x -= 10
     @status_window.contents_opacity += 10
   elsif @status_window.x <= 195
     @status_window.x = 195
     @status_window.contents_opacity = 255
   end
   if @mnop >= 255
     @mnop = 120
   end  
   if @command_window.active
     update_command
     return
   end
   if @status_window.active
     update_status
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when command window is active)
 #--------------------------------------------------------------------------
 def update_command
   case @command_window.index
   when 0  
     @mnsel.x = 0
     @mnsel.y = 110
   when 1
     @mnsel.x = 25
     @mnsel.y = 155
   when 2
     @mnsel.x = 40
     @mnsel.y = 197
   when 3
     @mnsel.x = 45
     @mnsel.y = 242
   when 4
     @mnsel.x = 25
     @mnsel.y = 285
   when 5
     @mnsel.x = 0
     @mnsel.y = 325
   end    
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
     return
   end
   if Input.trigger?(Input::C)
     if $game_party.actors.size == 0 and @command_window.index < 4
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     case @command_window.index
     when 0
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Item.new
     when 1
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 2
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 3
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 4
       if $game_system.save_disabled
         $game_system.se_play($data_system.buzzer_se)
       return
     end
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Save.new
     when 5
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_End.new
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when status window is active)
 #--------------------------------------------------------------------------
 def update_status  
   case @status_window.index
   when 0  
     @mnsel.x = 180
     @mnsel.y = 130
   when 1
     @mnsel.x = 180
     @mnsel.y = 195
   when 2
     @mnsel.x = 180
     @mnsel.y = 255
   when 3
     @mnsel.x = 180
     @mnsel.y = 320
   end  
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @command_window.active = true
     @status_window.active = false
     @status_window.index = -1
     return
   end
   if Input.trigger?(Input::C)
     case @command_window.index
     when 1
       if $game_party.actors[@status_window.index].restriction >= 2
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Skill.new(@status_window.index)
     when 2  
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Equip.new(@status_window.index)
     when 3  
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Status.new(@status_window.index)
       end
     return
   end
 end
end


By the way, I do have a pretty good understanding of scripting.

ForeverZer0

I don't have the time to test anything, but at a glance, it looks like this:


   if MOG::MAIN_FX == 0
     @mnback.oy += 1
     @mnback.ox += 1
     @mnback2.oy += 1
     @mnback2.ox -= 1
   end
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor

Hmm okay I'll throw that on another script and see if I can get the same effects.

EDIT:
Well never mind, I can't figure it out. I'm just stuck trying to get it moving. I can make the picture as the background but I can't figure out how use scripting to get it to move.


Please use the "Modify" button instead of double-posting. Thanks - Zer0

ForeverZer0

You need only to move the ox and oy, or x and y of the sprite containing the picture. You can even just move that sprites viewport to get the same effect, too.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor

Quote from: ForeverZer0 on November 06, 2011, 04:40:18 pm
You need only to move the ox and oy, or x and y of the sprite containing the picture. You can even just move that sprites viewport to get the same effect, too.


Wait what?... I'm trying to replicate this background on another window:



But it's like moving and looks animated. I don't really know how else to describe it.

ForeverZer0

I made this in a like 5 minutes, so forgive some of the sloppiness, etc, but it should help you get the idea.

Spoiler: ShowHide
class TestWindow < Window_Base
 
  def initialize(x, y, w, h, text)
    super(x, y, w, h)
    self.contents = Bitmap.new(w - 32, h - 32)
    self.back_opacity = 0
    viewport = Viewport.new(x+1, y+1, w-2, h-2)
    @backsprite = Plane.new(viewport)
    @backsprite.bitmap = Bitmap.new('test.png')
    self.contents.draw_text(0, 0, w, h, text, 1)
  end
 
  def update
    super
    @backsprite.ox += 1
    @backsprite.oy += 1
  end
 
  def dispose
    super
    @backsprite.dispose
  end
end

class Scene_Title
 
  alias test_main main
  def main
    test_main
    if @test_window != nil
      @test_window.dispose
    end
  end

  alias test_update update
  def update
    if @test_window == nil
      @test_window = TestWindow.new(160, 32, 320, 120, 'Look at the back move')
    end
    @test_window.update
    test_update
  end
end


Let me know if you need anything explained in more detail, I was too lazy to comment anything. :P
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor


ForeverZer0

Its was just a test, so I had it load from the main directory of the game. Just stick the image in the main folder with the Game.exe
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor

Okay I got it working now.

Damn, I have some work ahead of me trying to incorporate this into menu's /:

ForeverZer0

Not really.
You can actually just alias Window_Base, and add a check like "if $scene.is_a?(Scene_Menu)", and have it execute the background change if so. This will automatically apply it to every window in the scene.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor



This is the kind of background I'm trying to achieve. Sorry about the questions. I'm familiar with making windows and menus but not how to use images and animations.

EDIT: I guess I know just about nothing when it comes to real scripting. I know nothing of these "alias" you mentioned. I think I'm just more confused now...

ForeverZer0

Thats just a background, not a window background. That is considerably easier to accomplish.

Spoiler: ShowHide
class Window_Base
 
  alias test_init initialize
  def initialize(*args)
    test_init(*args)
    if $scene.is_a?(Scene_Menu)
      self.back_opacity = 60
    end
  end
end


class Scene_Menu
 
  alias test_main main
  def main
    viewport = Viewport.new(0, 0, 640, 480)
    viewport.z = -100
    @background = Plane.new(viewport)
    @background.bitmap = RPG::Cache.picture('menu_background')
   
    test_main
   
    @background.dispose
  end
 
  alias test_update update
  def update
    @background.ox += 2
    @background.oy -= 1
    test_update
  end
end


Place the picture in your Picture folder and name it as "menu_background". Open the menu and see.
You can adjust the values of the ox and oy to change the speed and direction of the movment.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor

Quote from: ForeverZer0 on November 06, 2011, 06:56:10 pm
Thats just a background, not a window background. That is considerably easier to accomplish.

Spoiler: ShowHide
class Window_Base
 
  alias test_init initialize
  def initialize(*args)
    test_init(*args)
    if $scene.is_a?(Scene_Menu)
      self.back_opacity = 60
    end
  end
end


class Scene_Menu
 
  alias test_main main
  def main
    viewport = Viewport.new(0, 0, 640, 480)
    viewport.z = -100
    @background = Plane.new(viewport)
    @background.bitmap = RPG::Cache.picture('menu_background')
   
    test_main
   
    @background.dispose
  end
 
  alias test_update update
  def update
    @background.ox += 2
    @background.oy -= 1
    test_update
  end
end


Place the picture in your Picture folder and name it as "menu_background". Open the menu and see.
You can adjust the values of the ox and oy to change the speed and direction of the movment.


That's much better. Last thing, his moves in several directions at once it seems. What else would need to be added to achieve that?

ForeverZer0

He uses two images and moves them different directions/speeds
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zephor

Quote from: ForeverZer0 on November 06, 2011, 07:11:41 pm
He uses two images and moves them different directions/speeds


That's I'm trying to do now but it either just shows one or the background is all black.

I'm also getting undefined methods for using background.z and background.blend_type

Zexion

What exactly is the menu you are going for? I have managed to make pretty big edits of mog's scripts to do what I need them too, so I may be able to help get the exact menu you want.

Zephor

EDIT: Actually there's to many changes that would need to be done. I'd rather just figure out the way to get his exact background movement. The way Zer0 posted isn't letting me use the two that Mog has.

I guess I should just list everything I want to do, then?

*I wanted to make the characters vertical (with only two character usable at one time) instead of horizontal so I could use these (I'm making the game after the anime):
Spoiler: ShowHide

*I was gonna change some of the names of the stats (this is fairly easy, just need to do some image editing.)
*For the most part, I need to make some windows like his for other things like shop, blacksmith, etc.

Hard to really think of other stuff on the spot. What kind of edits have you done?


Zexion

Well I've mainly done kingdom hearts script edits
Spoiler: ShowHide
Main Menu


Save Menu


both used mog's scripts, so as you can see they are kinda big edits.
(the blue bars in the main menu script move across the screen.)

I think I can do what you need actually, if you make me a mock up

Zephor

The only real requirement for the main part would be the four characters organized in this method (with the same background in Mogs script):


Other than that I wanna see what you could do with the other space. Some things I want different are:
*Tech instead of Skills.
*Stats instead of Status.
*Gear instead of Equip.
*No step counter.

That's all for now so you can see if you can do it >_<

Zexion

okay i'll try to get it to you tomorrow or the next day, meanwhile supply me with some background pics that you want.