设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1423|回复: 1
打印 上一主题 下一主题

[已经过期] 发一个修改过的地图显示领队状态的脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
帖子
33
跳转到指定楼层
1
发表于 2016-3-27 16:38:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
这是945窗口教程进行修改之后的脚本,增加了按F6打开关闭状态栏的功能。不过我是要请教一下,如何在状态栏开闭渐变过程中,角色依旧可以行走。求高手解答。


RUBY 代码复制
  1. #==============================================================================
  2. # ■ Class_Actor
  3. #==============================================================================
  4. class Game_Actor < Game_Battler
  5.  
  6.   alias moming_refresh refresh
  7.   alias moming_tp tp=
  8.   alias moming_add_state add_state
  9.   #--------------------------------------------------------------------------
  10.   # ● 刷新
  11.   #--------------------------------------------------------------------------
  12.   def refresh
  13.     moming_refresh
  14.     $refresh = true
  15.   end
  16.   #----------------------------------------------------------------------------
  17.   # ● 更改 TP
  18.   #----------------------------------------------------------------------------
  19.   def tp=(tp)
  20.     moming_tp(tp)
  21.     $refresh = true
  22.   end
  23.   #----------------------------------------------------------------------------
  24.   # ● 附加状态
  25.   #----------------------------------------------------------------------------
  26.   def add_state(state_id)
  27.     moming_add_state(state_id)
  28.     $refresh = true
  29.   end
  30. end
  31.  
  32. #==============================================================================
  33. # ■ Game_Party
  34. #==============================================================================
  35. class Game_Party
  36.  
  37.   alias moming_swap_order swap_order
  38.   #----------------------------------------------------------------------------
  39.   # ● 交换顺序
  40.   #----------------------------------------------------------------------------
  41.   def swap_order(index1, index2)
  42.     moming_swap_order(index1, index2)
  43.     $refresh = true
  44.   end
  45. end
  46. #==============================================================================
  47. # ■ Window_MapStatus
  48. #==============================================================================
  49. class Window_MapStatus < Window_Base
  50.   #----------------------------------------------------------------------------
  51.   # ● 初始化
  52.   #----------------------------------------------------------------------------
  53.    def initialize
  54.     super(0, 0, 273, 144)
  55.     self.opacity = 0
  56.     refresh
  57.   end
  58.  
  59.   #----------------------------------------------------------------------------
  60.   # ● 刷新画面
  61.   #----------------------------------------------------------------------------
  62.   def update
  63.     super
  64.  
  65.     refresh if $refresh
  66.     $refresh = false
  67.     if contents_opacity != 0
  68.       if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
  69.        $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
  70.       self.contents_opacity = 75
  71.       else self.contents_opacity = 255
  72.       end
  73.     end
  74.   end
  75.   #----------------------------------------------------------------------------
  76.   # ● 更新内容
  77.   #----------------------------------------------------------------------------
  78.   def refresh
  79.     contents.clear
  80.     draw_actor_face($game_party.members[0], 0, 0)
  81.     contents.draw_text(0,0,contents.width,24,$game_party.members[0].name,2)
  82.     draw_actor_level($game_party.members[0], 101, 0)
  83.     draw_actor_icons($game_party.members[0], 0, 72)
  84.     draw_actor_hp($game_party.members[0], 101, 24, self.contents.width - 101)
  85.     draw_actor_mp($game_party.members[0], 101, 48, self.contents.width - 101)
  86.     draw_actor_tp($game_party.members[0], 101, 72, self.contents.width - 101)
  87.     draw_actor_exp($game_party.members[0], 0, 96, self.contents.width)
  88.   end
  89.   #----------------------------------------------------------------------------
  90.   # ● 描绘EXP槽
  91.   #----------------------------------------------------------------------------
  92.   def draw_actor_exp(actor, x, y, width=124)
  93.     rate = actor.exp.to_f / actor.next_level_exp.to_f
  94.     draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100))
  95.     self.contents.font.color = text_color(16)
  96.     self.contents.draw_text(x, y, 56, 24, "EXP")
  97.     self.contents.font.color = Color.new(255, 255, 255)
  98.     en = "#{actor.exp}/#{actor.next_level_exp}"
  99.     self.contents.draw_text(x, y, width, 24, en, 2)
  100.   end
  101.   #----------------------------------------------------------------------------
  102.   # ● 描绘值槽
  103.   #----------------------------------------------------------------------------
  104.   def draw_gauge(x, y, width, rate, color1, color2)
  105.     fill_w = (width * rate).to_i
  106.     self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true)
  107.     self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true)
  108.     self.contents.fill_rect(x, y+12, width, 1, Color.new(255, 255, 255))
  109.     self.contents.fill_rect(x, y+22, width, 1, Color.new(255, 255, 255))
  110.     self.contents.fill_rect(x, y+14, 1, 8, Color.new(255, 255, 255))
  111.     self.contents.fill_rect(x+width-2, y+14, 1, 8, Color.new(255, 255, 255))
  112.   end
  113. end
  114.  
  115. #==============================================================================
  116. # ■ Scene_Map
  117. #==============================================================================
  118.  
  119.  
  120. class Scene_Map < Scene_Base
  121.   #----------------------------------------------------------------------------
  122.   # ● 重命名方法
  123.   #----------------------------------------------------------------------------
  124.   alias moming_sta start
  125.   alias moming_update update
  126.   #----------------------------------------------------------------------------
  127.   # ● 开始处理
  128.   #----------------------------------------------------------------------------
  129.   def start
  130.     moming_sta
  131.     @mapstatus_window = Window_MapStatus.new
  132.   end
  133.   #----------------------------------------------------------------------------
  134.   # ● 更新处理
  135.   #----------------------------------------------------------------------------
  136.   def update
  137.     moming_update
  138.     ms_update_input
  139.   end
  140.   #----------------------------------------------------------------------------
  141.   # ● 按键检测
  142.   #----------------------------------------------------------------------------  
  143.   def ms_update_input
  144.     if Input.trigger?(:F6)
  145.       if @mapstatus_window.contents_opacity != 0
  146.         gra_close
  147.       else
  148.         gra_open
  149.       end
  150.     end
  151.   end
  152.   #----------------------------------------------------------------------------
  153.   # ● 定义窗口淡入、淡出
  154.   #----------------------------------------------------------------------------  
  155.   def gra_close
  156.     60.times do |i|
  157.       @mapstatus_window.contents_opacity -= 4.25
  158.       Graphics.update
  159.  
  160.     end
  161.   end
  162.  
  163.   def gra_open
  164.     60.times do |i|
  165.       @mapstatus_window.contents_opacity += 4.25
  166.       Graphics.update
  167.     end
  168.   end
  169.  
  170. end
  171. #转自945窗口脚本教程,并稍作修改。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
帖子
33
2
 楼主| 发表于 2016-3-28 22:01:30 手机端发表。 | 只看该作者
这就沉了?咋没人愿意试试呢?
来自: Android客户端
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-28 05:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表