查看: 1542|回复: 0

[已经过期] 如何用Sprite做显示ARPG群战的角色头像

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2023-4-8 15:58:50 | 显示全部楼层 |阅读模式

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

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

×
用class Sprite_Character < RPG::Sprite
还是用class Sprite_map < RPG::Sprite





[pre lang="ruby"]class Window_kg_status < Window_Base
class Sprite_Character < RPG::Sprite
  
  #我方  
  def initialize(actor_id, window_index)
    super(540 - window_index * 76 , 540, 117, 190)
    @actor_id = actor_id
    self.contents = Bitmap.new(width - 1, height- 1 )
    self.opacity = 0
    refresh
  end
  
  def dispose
    super
  end
  
  def refresh
    self.contents.clear
    #draw_actor_name($game_actors[@actor_id], 0, 0)
    draw_actor_picture($game_actors[@actor_id].battler_name, $game_actors[@actor_id].battler_hue, -1 ,+1)
    draw_actor_hp($game_actors[@actor_id], 1, 110)
    draw_actor_sp($game_actors[@actor_id], 134, 135)
    draw_actor_cp($game_actors[@actor_id], 134, 160)
  end
  
  class Window_Base < Window
  #我方
  def draw_actor_cp(actor, x, y, width = 90, height = 15)
    w = [actor.cp, 100].min / 100 * width
    self.contents.fill_rect(x, y, width,height,Color.new(0,0,0))
    self.contents.fill_rect(x, y + 1 , width,height -2,Color.new(255, 255, 128))
    self.contents.fill_rect(x + 1, y + 1, w, height -2,Color.new(255,255,255))
  end
  
  def draw_actor_picture(actor_name, actor_hue, x, y)
    bitmap = RPG::Cache.battler(actor_name,actor_hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(x, y, bitmap, src_rect)
  end[/pre]
队标id.png
完成.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部