Skip to content

Instantly share code, notes, and snippets.

@TakkunMaker
Created June 16, 2018 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakkunMaker/d458d97cf4a2cdee698da0f79181e808 to your computer and use it in GitHub Desktop.
Save TakkunMaker/d458d97cf4a2cdee698da0f79181e808 to your computer and use it in GitHub Desktop.
#==============================================================================
# ** MAYA - Mouse Title Screen
#------------------------------------------------------------------------------
# Autor: Takkun (a.k.a Faalco)
# Create: 14/06/2018
# Version: 1.0a
#==============================================================================
# * Instructions & Info:
# -----------------------------------------------------------------------------
# Paste the script above the main of your project, and make the necessary
# settings. This script requires the Jet Mouse to VX Ace to place it above
# this script to avoid incompatibilities.
#
# This script (Only the MAYA - Mouse Title Screen) can be used for commercial
# and non-commercial purposes, credits are welcome but not required.
#
# Jet Mouse for VX Ace was created by the same then all credits are to it.
#
# Any problems before the script can be taken on the topics of the same or by
# personal message us forums in which I participate.
#
#==============================================================================
($imported ||= {})["MAYA - Mouse Title Screen"] = true
#==============================================================================
# ** MAYA Module
#------------------------------------------------------------------------------
# All the settings of this script can be made in this module.
#==============================================================================
module MAYA
#--------------------------------------------------------------------------
# * Logotipe Image (System Folder).
#--------------------------------------------------------------------------
Logotipe = "Logo"
#--------------------------------------------------------------------------
# * Logotipe Position.
#--------------------------------------------------------------------------
Logotipe_Position = [111, 155] # X, Y
#--------------------------------------------------------------------------
# * Menu Buttons Images (System Folder).
#--------------------------------------------------------------------------
MenuButtons = ["NewGame", "Continue", "Exit"]
#--------------------------------------------------------------------------
# * Menu Buttons X Position.
#--------------------------------------------------------------------------
MenuButtonsX = [229, 236, 257]
#--------------------------------------------------------------------------
# * Menu Buttons Y Position.
#--------------------------------------------------------------------------
MenuButtonsY = [289, 313, 337]
#--------------------------------------------------------------------------
# * Menu Buttons OFF Opacity.
#--------------------------------------------------------------------------
MenuButtons_OFF = 100
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
SceneManager.clear
Graphics.freeze
create_logotipe
create_background
create_button_menu
play_title_music
end
#--------------------------------------------------------------------------
# * Get Transition Speed
#--------------------------------------------------------------------------
def transition_speed
return 20
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
SceneManager.snapshot_for_background
dispose_all_images
end
#--------------------------------------------------------------------------
# * Dispose All Images
#--------------------------------------------------------------------------
def dispose_all_images
@sprite1.bitmap.dispose
@sprite1.dispose
@logotipe.dispose
@op1.dispose
@op2.dispose
@op3.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_basic
end
#--------------------------------------------------------------------------
# * Update Frame (Basic)
#--------------------------------------------------------------------------
def update_basic
Graphics.update
Input.update
update_menu_buttons
update_all_windows
end
#--------------------------------------------------------------------------
# * Create Background
#--------------------------------------------------------------------------
def create_background
@sprite1 = Sprite.new
@sprite1.bitmap = Cache.title1($data_system.title1_name)
center_sprite(@sprite1)
end
#--------------------------------------------------------------------------
# * Create Logotipe
#--------------------------------------------------------------------------
def create_logotipe
@logotipe = Sprite.new
@logotipe.bitmap = Cache.system(MAYA::Logotipe)
@logotipe.x = MAYA::Logotipe_Position[0]
@logotipe.y = MAYA::Logotipe_Position[1]
@logotipe.z = 300
end
#--------------------------------------------------------------------------
# * Create Logotipe
#--------------------------------------------------------------------------
def create_button_menu
# Create Title Images
@op1 = Sprite.new
@op2 = Sprite.new
@op3 = Sprite.new
# Bitmap Images
@op1.bitmap = Cache.system(MAYA::MenuButtons[0])
@op2.bitmap = Cache.system(MAYA::MenuButtons[1])
@op3.bitmap = Cache.system(MAYA::MenuButtons[2])
# Position X
@op1.x = MAYA::MenuButtonsX[0]
@op2.x = MAYA::MenuButtonsX[1]
@op3.x = MAYA::MenuButtonsX[2]
# Position Y
@op1.y = MAYA::MenuButtonsY[0]
@op2.y = MAYA::MenuButtonsY[1]
@op3.y = MAYA::MenuButtonsY[2]
# Position Z
@op1.z = @op2.z = @op3.z = 300
# Opacity
@op1.opacity = @op2.opacity = @op3.opacity = MAYA::MenuButtons_OFF
end
#--------------------------------------------------------------------------
# * Update Menu Buttons
#--------------------------------------------------------------------------
def update_menu_buttons
# New Game
if Mouse.area?(@op1.x, @op1.y, @op1.width, @op1.height)
on_sprite(@op1)
if Mouse.press?(1)
DataManager.setup_new_game
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
else
off_sprite(@op1)
end
# Continue
if Mouse.area?(@op2.x, @op2.y, @op2.width, @op2.height)
on_sprite(@op2)
if Mouse.press?(1)
SceneManager.call(Scene_Load)
end
else
off_sprite(@op2)
end
# Exit
if Mouse.area?(@op3.x, @op3.y, @op3.width, @op3.height)
on_sprite(@op3)
if Mouse.press?(1)
fadeout_all
SceneManager.exit
end
else
off_sprite(@op3)
end
end
#--------------------------------------------------------------------------
# * Move Sprite to Screen Center
#--------------------------------------------------------------------------
def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end
#--------------------------------------------------------------------------
# * Play Title Screen Music
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
#--------------------------------------------------------------------------
# * On Sprite
#--------------------------------------------------------------------------
def on_sprite(sprite)
if sprite.opacity < 255
sprite.opacity += 6
end
end
#--------------------------------------------------------------------------
# * Off Sprite
#--------------------------------------------------------------------------
def off_sprite(sprite)
if sprite.opacity > 100
sprite.opacity -= 6
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment