Project1

标题: 如何右边显示敌人头像和血条我这段脚本有冲突 [打印本页]

作者: 金芒芒    时间: 2023-3-9 11:07
标题: 如何右边显示敌人头像和血条我这段脚本有冲突
本帖最后由 金芒芒 于 2023-3-9 16:00 编辑

RUBY 代码复制
  1. class Window_kg_status < Window_Base
  2. #我方  
  3.   def initialize(actor_id, window_index)
  4.     super(560 - window_index * 76 , 540, 117, 150)
  5.     @actor_id = actor_id
  6.     self.contents = Bitmap.new(width - 1, height- 1 )
  7.     self.opacity = 0
  8.     refresh
  9.   end
  10.  
  11.   def dispose
  12.     super
  13.   end
  14.  
  15.   def refresh
  16.     self.contents.clear
  17.     #draw_actor_name($game_actors[@actor_id], 0, 0)
  18.     draw_actor_picture($game_actors[@actor_id].battler_name, $game_actors[@actor_id].battler_hue, +1 ,+1)
  19.     draw_actor_hp($game_actors[@actor_id], 50, 25)
  20.     draw_actor_sp($game_actors[@actor_id], 134, 50)
  21.     draw_actor_cp($game_actors[@actor_id], 134, 80)
  22.   end
  23. #敌方
  24.   def initialize(enemy_id, window_index)
  25.     super(640 + window_index * 76 , 540, 117, 150)
  26.     @enemy_id = enemy_id
  27.     self.contents = Bitmap.new(width - 1, height- 1 )
  28.     self.opacity = 0
  29.     refresh
  30.   end
  31.  
  32.   def dispose
  33.     super
  34.   end
  35.  
  36.   def refresh
  37.     self.contents.clear
  38.     #draw_actor_name($game_actors[@actor_id], 0, 0)
  39.     draw_enemy_picture($game_enemy[@enemy_id].battler_name, $game_enemy[@enemy_id].battler_hue, +1 ,+1)
  40.     draw_enemy_hp($game_enemy[@enemy_id], 50, 25)
  41.     draw_enemy_sp($game_enemy[@enemy_id], 134, 50)
  42.     draw_enemy_cp($game_enemy[@enemy_id], 134, 80)
  43.   end
  44.  
  45.  
  46.  
  47. end
  48.  
  49. #enemy
  50.  
  51.  
  52.  
  53. class Window_Base < Window
  54.   #我方
  55.   def draw_actor_cp(actor, x, y, width = 90, height = 15)
  56.     w = [actor.cp, 100].min / 100 * width
  57.     self.contents.fill_rect(x, y, width,height,Color.new(0,0,0))
  58.     self.contents.fill_rect(x, y + 1 , width,height -2,Color.new(255, 255, 128))
  59.     self.contents.fill_rect(x + 1, y + 1, w, height -2,Color.new(255,255,255))
  60.   end
  61.  
  62.   def draw_actor_picture(actor_name, actor_hue, x, y)
  63.     bitmap = RPG::Cache.battler(actor_name,actor_hue)
  64.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  65.     self.contents.blt(x, y, bitmap, src_rect)
  66.   end
  67. #敌方
  68.   def draw_actor_cp(enemy, x, y, width = 90, height = 15)
  69.     w = [enemy.cp, 100].min / 100 * width
  70.     self.contents.fill_rect(x, y, width,height,Color.new(0,0,0))
  71.     self.contents.fill_rect(x, y + 1 , width,height -2,Color.new(255, 255, 128))
  72.     self.contents.fill_rect(x + 1, y + 1, w, height -2,Color.new(255,255,255))
  73.   end
  74.  
  75.   def draw_enemy_picture(enemy_name, enemy_hue, x, y)
  76.     bitmap = RPG::Cache.battler(enemy_name,enemy_hue)
  77.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  78.     self.contents.blt(x, y, bitmap, src_rect)
  79.   end  
  80.  
  81.  
  82. end

右边显示敌人头像.png (1.44 MB, 下载次数: 5)

右边显示敌人头像.png

CP技能.jpg (279.15 KB, 下载次数: 6)

CP技能.jpg

完成.png (220.89 KB, 下载次数: 5)

完成.png





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1