Skip to content

Instantly share code, notes, and snippets.

@TakkunMaker
Created April 25, 2017 01:59
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/7e3bf3c21cb25a4d77096b4004619b05 to your computer and use it in GitHub Desktop.
Save TakkunMaker/7e3bf3c21cb25a4d77096b4004619b05 to your computer and use it in GitHub Desktop.
TK - Icon Menu
#==============================================================================
# ** TK - Icon Menu
#------------------------------------------------------------------------------
# Autor: Takkun (a.k.a Faalco)
# Create: 25/04/2017
# 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 TK - Icon Menu) 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 ||= {})["TK - Icon Menu"] = true
#==============================================================================
# ** TK Module
#------------------------------------------------------------------------------
# All the settings of this script can be made in this module.
#==============================================================================
module TK
#--------------------------------------------------------------------------
# * Menu Icon Pictures (System Folder).
#--------------------------------------------------------------------------
MenuIcon = ["Items", "Skills", "Equip", "Status", "Save", "Exit"]
#--------------------------------------------------------------------------
# * Menu Icon X Position
#--------------------------------------------------------------------------
MenuIcon_X = [10, 34, 58, 82, 106, 130]
#--------------------------------------------------------------------------
# * Menu Icon Y Position
#--------------------------------------------------------------------------
MenuIcon_Y = 387
#--------------------------------------------------------------------------
# * Menu Icon OFF Opacity
#--------------------------------------------------------------------------
MenuIcons_OFF = 100
end
#==============================================================================
# ** Configuration module
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias
#--------------------------------------------------------------------------
alias :tk_icon123_menu_initialize :initialize
alias :tk_icon123_menu_dispose :dispose
alias :tk_icon123_menu_update :update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
create_icon_menu
tk_icon123_menu_initialize
end
#--------------------------------------------------------------------------
# * Create Icon Menu
#--------------------------------------------------------------------------
def create_icon_menu
# Create Menu Icons
@op1 = Sprite.new
@op2 = Sprite.new
@op3 = Sprite.new
@op4 = Sprite.new
@op5 = Sprite.new
@op6 = Sprite.new
# Bitmap Icons
@op1.bitmap = Cache.system(TK::MenuIcon[0])
@op2.bitmap = Cache.system(TK::MenuIcon[1])
@op3.bitmap = Cache.system(TK::MenuIcon[2])
@op4.bitmap = Cache.system(TK::MenuIcon[3])
@op5.bitmap = Cache.system(TK::MenuIcon[4])
@op6.bitmap = Cache.system(TK::MenuIcon[5])
# Position X
@op1.x = TK::MenuIcon_X[0]
@op2.x = TK::MenuIcon_X[1]
@op3.x = TK::MenuIcon_X[2]
@op4.x = TK::MenuIcon_X[3]
@op5.x = TK::MenuIcon_X[4]
@op6.x = TK::MenuIcon_X[5]
# Position Y
@op1.y = @op2.y = @op2.y = @op3.y = @op4.y = @op5.y = @op6.y = TK::MenuIcon_Y
# Position Z
@op1.z = @op2.z = @op2.z = @op3.z = @op4.z = @op5.z = @op6.z = 300
# Opacity
@op1.opacity = @op2.opacity = @op3.opacity = @op4.opacity = @op5.opacity = @op6.opacity = TK::MenuIcons_OFF
end
#--------------------------------------------------------------------------
# * Free
#--------------------------------------------------------------------------
def dispose
dispose_icon_menu
tk_icon123_menu_dispose
end
#--------------------------------------------------------------------------
# * Free Icon Menu
#--------------------------------------------------------------------------
def dispose_icon_menu
@op1.dispose
@op2.dispose
@op3.dispose
@op4.dispose
@op5.dispose
@op6.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_icon_menu
tk_icon123_menu_update
end
#--------------------------------------------------------------------------
# * Update Icon Menu
#--------------------------------------------------------------------------
def update_icon_menu
# Scene Item
if Mouse.area?(@op1.x, @op1.y, @op1.width, @op1.height)
on_sprite(@op1)
if Mouse.press?(1)
SceneManager.call(Scene_Item)
end
else
off_sprite(@op1)
end
# Scene Skill
if Mouse.area?(@op2.x, @op2.y, @op2.width, @op2.height)
on_sprite(@op2)
if Mouse.press?(1)
SceneManager.call(Scene_Skill)
end
else
off_sprite(@op2)
end
# Scene Equip
if Mouse.area?(@op3.x, @op3.y, @op3.width, @op3.height)
on_sprite(@op3)
if Mouse.press?(1)
SceneManager.call(Scene_Equip)
end
else
off_sprite(@op3)
end
# Scene Status
if Mouse.area?(@op4.x, @op4.y, @op4.width, @op4.height)
on_sprite(@op4)
if Mouse.press?(1)
SceneManager.call(Scene_Status)
end
else
off_sprite(@op4)
end
# Scene Save
if Mouse.area?(@op5.x, @op5.y, @op5.width, @op5.height)
on_sprite(@op5)
if Mouse.press?(1)
SceneManager.call(Scene_Save)
end
else
off_sprite(@op5)
end
# Scene End
if Mouse.area?(@op6.x, @op6.y, @op6.width, @op6.height)
on_sprite(@op6)
if Mouse.press?(1)
SceneManager.call(Scene_End)
end
else
off_sprite(@op6)
end
end
#--------------------------------------------------------------------------
# * Formation [OK]
#--------------------------------------------------------------------------
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------------------------------------------------------------------
# * Formation [Cancel]
#--------------------------------------------------------------------------
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.pending_index = -1
@status_window.activate
else
@status_window.unselect
@command_window.activate
end
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
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Call Menu Screen
#--------------------------------------------------------------------------
def call_menu
# Empty
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment