注册会员 登录
Project1 返回首页

鼠窝 https://rpg.blue/?335626 [收藏] [复制] [分享] [RSS] ~外站脚本图书馆~

日志

IB菜单

热度 3已有 490 次阅读2014-5-17 13:34 |个人分类:外站脚本

################################################################################
##### IB Menu
################################################################################
# Author : Biward
# Date : 21/08/2013 19:50
# Version : VXAce
#
# This script let you have a IBLike Menu. It shows the life of an hero that you
# can define with script calls and it shows the objects that you wanted to show
#
# Three commands :
# - perso_menu(id)
# The menu will show the life of the actor id.
#
# - menu_item(id)
# This command add the item id in the menu
#
# - remove_menu_item(id)
# This command remove the item id of the menu
################################################################################
##### ConfigurationMenu
################################################################################
module BIKO
  # Life Bar's position [x, y]
   Position_life = [32, 80]
    
  # First Item's position  [x, y]
  Position_items = [200, 80]
    
   # Indicate here the ID of the actor
  Id_hero = 1
 end
################################################################################
##### Beginning of the Script
################################################################################
### Scene_Menu
class Scene_Menu
    
   class << self
     attr_accessor :perso, :items
  end
  #----------------------------------START--------------------------------------
  def start
     super
     check_variables
     create_back
     create_life
     create_window_items
  end
    
  def check_variables
    Scene_Menu.perso ||= BIKO::Id_hero if BIKO::Id_hero > 0
    Scene_Menu.items ||= []
  end  
    
  def create_life
    @window_life = Window_Base.new(-16, -16, Graphics.width + 32, Graphics.height + 32)
    @window_life.opacity = 0
    spritelife_back = Cache.system("HP_BAR_BACK")
    spritelife = Cache.system("HP_BAR")
    src_rect_back = Rect.new(0, 0, spritelife.width, spritelife.height)
    mp = ($game_actors[Scene_Menu.perso].hp.to_f / $game_actors[Scene_Menu.perso].mhp.to_f ).to_f * spritelife.height.to_f
    src_rect = Rect.new(0, spritelife.height - mp, spritelife.width, spritelife.height)
     x = BIKO::Position_life[0]
     y = BIKO::Position_life[1]
     pp = spritelife.height - mp
     @window_life.contents.blt(x, y, spritelife_back, src_rect_back)
     @window_life.contents.blt(x, y + pp, spritelife, src_rect)
   end
    
   def create_back
     @spriteback = Sprite.new
     @spriteback.bitmap = Cache.system("MenuBack")  
   end
    
  def create_window_items
    @img ||= []
    @x ||= BIKO::Position_items[0]
    @y ||= BIKO::Position_items[1]
    @i ||= 0
    Scene_Menu.items.each do |i|
      @img << Sprite.new
      @img[@i].bitmap = Cache.system($data_items[i].name.to_s)
      @img[@i].x = @x ; @img[@i].y = @y
      @y += @img[@i].height ; @i += 1
    end
  end
    
  #---------------------------------TERMINATE-----------------------------------
  def terminate
    super
    dispose_life
    dispose_back
    dispose_window_items
  end
    
  def dispose_life
    @window_life.dispose
  end
    
  def dispose_back
    @spriteback.dispose
  end
  
  def dispose_window_items
    @img.each { |i| i.dispose }
  end
    
  #------------------------------------UPDATE-----------------------------------
  def update
    super
    SceneManager.return if Input.trigger?(:B)
  end
end
 ### Game_Interpreter
 class Game_Interpreter
   def perso_menu(id)
     Scene_Menu.perso = id
   end
   def menu_item(id)
     Scene_Menu.items ||= []
     Scene_Menu.items << id if ! Scene_Menu.items.include?(id)
   end
   def remove_menu_item(id)
     Scene_Menu.items ||= []
     index = Scene_Menu.items.index(id) if Scene_Menu.items.include?(id)
     Scene_Menu.items.delete_at(index) if index
   end
 end
 ################################################################################
 ##### End of the Script
 ################################################################################

鸡蛋

鲜花

刚表态过的朋友 (0 人)

发表评论 评论 (2 个评论)

回复 xingmot 2014-7-13 08:37
有图咩?(给鲜花)
回复 月华风 2014-9-22 09:54
= = 有没有使用规约?

facelist doodle 涂鸦笔

您需要登录后才可以评论 登录 | 注册会员

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 07:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部