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

Project1

 找回密码
 注册会员
搜索
查看: 1621|回复: 0

[已经过期] 图片显示简化

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1860 小时
注册时间
2010-6-19
帖子
1204
发表于 2022-5-29 10:55:23 | 显示全部楼层 |阅读模式

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

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

x
发现脚本里面显示图片太过繁琐了,如何改成类似下面这样简洁显示?


if @battler.startactive == "待机"
if Graphics.frame_count % 7 == 0
  unless BattlerName_Actor[@battler.battler_name].nil?
    @number = (@number + 1) % BattlerName_Actor[@battler.battler_name][@battler.startactive].size
    self.bitmap = RPG::Cache.battler(BattlerName_Actor[@battler.battler_name][@battler.startactive][@number], @battler_hue)
   end

module Scene_BattleName
  # 移动速度
  Move_Duration = 60
  # 角色
  BattlerName_Actor = {  "友-梦灵泉(待)" => {
  "待机" => ["友-梦灵泉(待)","梦灵泉/友/待/2","梦灵泉/友/待/3","梦灵泉/友/待/4","梦灵泉/友/待/5","梦灵泉/友/待/6","梦灵泉/友/待/7","梦灵泉/友/待/8","梦灵泉/友/待/9","梦灵泉/友/待/10","梦灵泉/友/待/11","梦灵泉/友/待/12"]},
  }  

end
class Scene_Battle
  include Scene_BattleName
end
class Sprite_Battler
  include Scene_BattleName
end



上面的图片显示太过繁琐如何改成下面那样,直接简化显示



class Window_BabyFace < Window_Base
  def initialize
    super(180-32, 20-32, 150+64, 220+64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @bitmap_index = 0
    @rect = Rect.new(0, 0, 0, 0)
  end
  def refresh(actor)
    self.contents.clear
    return if actor.nil? or BattlerName_Actor[actor.name].nil?
    if @id != actor.id or @face != actor.face
      @id = actor.id
      @face = actor.face
      @bitmap_index = 0
      str = BattlerName_Actor[actor.name][actor.face]
      @index = [*str.split("-")[0].to_i..str.split("-")[1].to_i]
    end
    bitmap = Bitmap.new("Graphics/Battlers/#{actor.name}/敌/#{actor.face}/" +
    sprintf("%d",@index[@bitmap_index]))
   
    self.contents.blt(-55, -45, bitmap, @rect.set(0, 0, bitmap.width, bitmap.height))
    @bitmap_index += 1
    if @bitmap_index >= @index.size
      @bitmap_index = 0
      if rand(100) < 10
        ar = BattlerName_Actor[actor.name].keys
        actor.face = ar[rand(ar.size)]
      end
    end
  end
end


BattlerName_Actor = {
"梦灵泉"=>{"待机"=>"1-7"},

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

本版积分规则

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

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

GMT+8, 2024-3-29 02:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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