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

Project1

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

[有事请教] 窗口模式改成精灵模式

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6301
在线时间
1104 小时
注册时间
2015-8-15
帖子
658
跳转到指定楼层
1
发表于 2023-6-17 16:19:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#==============================================================================
# ■ Window_db
#------------------------------------------------------------------------------
#  显示队标动画的窗口
#==============================================================================

class Window_db < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化目标
  #--------------------------------------------------------------------------
  def initialize
    super((640-60)/2-16, (480-90)/2-16-64, 60, 90)
    self.contents = Bitmap.new(width - 32, height - 32)
    @count = @kind = 0
    # 隐藏窗口可见度
    self.opacity = 0
    self.z = 350
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # 队标显示
    refresh_sprite(0, 0, @kind)
  end
  #---------------------------------------------------------------------------
  # ● 刷新人物动态图
  #---------------------------------------------------------------------------
  def update
    super
    self.x = $game_player.screen_x-96
    self.y = $game_player.screen_y-20
    self.visible = (a=($game_party.actors[0] || $game_actors[1])).hp >= a.maxhp * 0.05
    @count += 1
    # 设置图片刷新速度
    @count = 0 if @count >= 30
    if @count / 2 != @kind
      @kind = @count / 2
      refresh
    end
  end
end

#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类。
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     x      : 窗口的 X 坐标
  #     y      : 窗口的 Y 坐标
  #     width  : 窗口的宽
  #     height : 窗口的宽
  #--------------------------------------------------------------------------  
  def refresh_sprite(x, y, kind)
    bitmap = RPG::Cache.picture("图片显示/动态图/队标")
    w = bitmap.width / 15
    src_rect = Rect.new(kind * w, 0, w, bitmap.height)
    self.contents.blt(x, y, bitmap, src_rect)
  end
end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-2 03:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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