The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Tutorials => Topic started by: GamingCraving on August 19, 2010, 10:44:50 PM

Title: [RMXP] "Animated" Menu
Post by: GamingCraving on August 19, 2010, 10:44:50 PM
So someone tells me you guys don't have a moving menu tutorial.. well i did this myself then found out there was a tutorial else where for it... so i'll be nice and share the info i recieved... from my own coding and from the tutorial.


NOTE: This moving menu was made in RPG Maker XP... it should be able to convert to VX and maybe back to 2k.


first you want to open your script editor and insert a blank script called... well whatever you want really... mine was "Title Screen"

now heres the big secret to making it work...

place the following two lines of code into the script.


SEPERATE_CONTINUE_DISABLED_IMAGES = true
TRANSITION_FRAMES = 5



this establishes that there are a total of 6 images used.

now you have to laod everything the menu does on it's own, so go into the Scene_Title (default name) and copy from "class Scene_Title" to "@sprite = Sprite.new". This is the basics for the loading screen and well the rest of the game.

now under that place


@back_sprite = Sprite.new
@back_sprite.z = @sprite.z - 10

and the counters

@index = 0
@count = -1
@delta = 255 / TRANSITION_FRAMES


now that we've established the grounds for the menu we have to check for a save file so we can display "Load" or "Continue" as valid or not we do so with teh following code using our index.


@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end


If we have found a save file we will assume that's what they want to do and move the cursor there, else we will want tostay on new game (default) and grey out the continue option.


if @continue_enabled
@index = 1
@sprite.bitmap = RPG::Cache.title("1")
else
if SEPERATE_CONTINUE_DISABLED_IMAGES
@sprite.bitmap = RPG::Cache.title("0d")
else
@sprite.bitmap = RPG::Cache.title("0")
end
end


this gives us a starting point for the cursor all that's left is to play the music and get the updates.


# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop


and get the updates as they happen.

Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
@back_sprite.dispose
end


Your more than halfway to completing this tutorial on moving title screens... hehe

However we need to make the frame update, Which is called via the update command in the main loop of the title screen.


def update
if @count > -1
if @count == 0
if SEPERATE_CONTINUE_DISABLED_IMAGES and !@continue_enabled
@sprite.bitmap = RPG::Cache.title(@index.to_s + 'd')
else
@sprite.bitmap = RPG::Cache.title(@index.to_s)
end
@sprite.opacity = 255
else
@sprite.opacity -= @delta
end
@count -= 1
return
end


but we also need to make the inputs too.. seeing as how we've just overwritten everything that Scene_Title does basically... We do this like so... using our index as the point for where we are in the menu. Clever huh?


if Input.repeat?(Input::UP) or Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index = (@index - 1) % 3
@count = TRANSITION_FRAMES
if SEPERATE_CONTINUE_DISABLED_IMAGES and !@continue_enabled
@back_sprite.bitmap = RPG::Cache.title(@index.to_s + 'd')
else
@back_sprite.bitmap = RPG::Cache.title(@index.to_s)
end
end

if Input.repeat?(Input::DOWN) or Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 3
@count = TRANSITION_FRAMES
if SEPERATE_CONTINUE_DISABLED_IMAGES and !@continue_enabled
@back_sprite.bitmap = RPG::Cache.title(@index.to_s + 'd')
else
@back_sprite.bitmap = RPG::Cache.title(@index.to_s)
end
end


# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @index
when 0 # New game
command_new_game
when 1 # Continue
command_continue
when 2 # Shutdown
command_shutdown
end
end
end
end


Once all of that is complete you will need a total of 6 images. Named as the following.

0, 0d, 1, 1d, 2, 2d

These will differentiate each type of menu, Continue active and continue inactive. Any picture with a d next to it like "0d" is used for when the Load function is available.

you can make the screen how ever you like, and have the 3 main selections anywhere on the screen, But you can experiment with that. For you have finished coding the Moving Menu and it's up to you to design the GUI now. Good luck and have fun.

By Ariachan&BurningFetus
Title: Re: [RM2K3] "Animated" Menu
Post by: modern algebra on August 19, 2010, 11:35:09 PM
Well looks nice. Scripts are only in XP and VX though, so it wouldn't be able to apply to 2k3 or 2k. Maybe change the name?
Title: Re: [RM2K3] "Animated" Menu
Post by: GamingCraving on August 20, 2010, 01:19:33 AM
Well looks nice. Scripts are only in XP and VX though, so it wouldn't be able to apply to 2k3 or 2k. Maybe change the name?
http://www.youtube.com/watch?v=YZ2twFzgsmg
http://www.youtube.com/watch?v=_JkAcWITqgE
http://www.youtube.com/watch?v=Syjbf6KiYKc&NR=1

Explain those to me?
Title: Re: [RM2K3] "Animated" Menu
Post by: cozziekuns on August 20, 2010, 01:27:57 AM
IIRC, there are several unnoficial hacks and addons which can get you the most out of RM2K3, however I don't think you can script with it.
Title: Re: [RM2K3] "Animated" Menu
Post by: modern algebra on August 20, 2010, 01:44:32 AM
Yeah, some people made hacks and patches for RM2k3. What those ones probably were were a simple skip the original title patch (like http://dl1.rpg-atelier.net/ressourcen2/programme/AutoEnterPatch.exe) and then an evented title screen.

In any case, those cracks and patches are a lot different than scripting, and so the method you are describing would not work in RM2k3. Still, it's useful for RMXP.
Title: Re: [RM2K3] "Animated" Menu
Post by: GamingCraving on August 20, 2010, 03:12:36 AM
I guess I should take it down then, I'm strictly RM2K3.
Title: Re: [RM2K3] "Animated" Menu
Post by: modern algebra on August 20, 2010, 04:17:00 AM
Well, your choice I guess. I don't really see why though. It's helpful for RMXP folk after all.
Title: Re: [RMXP] "Animated" Menu
Post by: GamingCraving on August 20, 2010, 04:44:17 AM
Renamed it, sorry I was being selfish.