Before I get into it, I suggest adding comments and using proper indenting for easier reading of your scripts.
1.) How to tell if the menu was opened from map or from another sub-menu:
class Scene_KEngineMain
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0, from_map = true)
@menu_index = menu_index
@from_map = from_map
end
And in your sub-menus (note the
false when declaring the Menu Scene):
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$from_map = 0
$scene = Scene_KEngineMain.new(0, false)
return
end
2.) Your waves in the background
The x-values of those sprites do nothing by the way. A simple print function gave me
nil all the time. So, instead of
@mnan.x, set it to
@mnan.ox.
First, adding variables to
Game_Temp:
class Game_Temp
attr_accessor :wave1, :wave2, :wave3
alias reinit_for_wave_oxs initialize
def initialize
reinit_for_wave_oxs
@wave1, @wave2, @wave3 = 0, 0, 0
end
def store_wave_oxs(w1, w2, w3)
@wave1, @wave2, @wave3 = w1, w2, w3
end
end
And an example of how to initialize your waves in the Main Menu class:
@mnan.ox = @from_map ? 0 : $game_temp.wave1
And an example in the sub-menu classes:
@mnan.ox = $game_temp.wave1
Also, in both Menu and Sub-menu classes, add this line directly above the
Graphics.freeze:
$game_temp.store_wave_oxs(@mnan.ox, @mnan2.ox, @mnan3.ox)
Blarg, so tired...hopefully I didn't miss anything.