| 赞 | 1  | 
 
| VIP | 246 | 
 
| 好人卡 | 87 | 
 
| 积分 | 1 | 
 
| 经验 | 34142 | 
 
| 最后登录 | 2015-1-15 | 
 
| 在线时间 | 323 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 55 
 
        - 在线时间
 - 323 小时
 
        - 注册时间
 - 2010-8-21
 
        - 帖子
 - 666
 
 
 
 | 
	
 本帖最后由 沙漠点灰 于 2012-10-28 00:00 编辑  
 
显示图片强化和这个没什么关系吧... 
这些"图片"在Scene_Sxxxx什么的是"嵌"在窗口中的,而非精灵,所以处理起来不方便,也很慢(即便如此,也看不出来卡顿...以范例来看). 
若楼主执意要的话,脚本就在下面。若楼主需要将其载入Cache中请再次说明(再次载入就无需处理),最好再给点经验。 
#--------------------------------------------------------------------------   # ● 战斗图形的描绘   #     actor : 角色   #     x     : 描画目标 X 坐标   #     y     : 描画目标 Y 坐标   #--------------------------------------------------------------------------   def draw_battler_graphic(actor, x, y)      battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)     w = battler.width     h = battler.height     if defined? yield       bitmap2 = Bitmap.new(battler.height, battler.width)       h.times{|x|w.times{|y|bitmap2.set_pixel(x, y, battler.get_pixel(*yield(x,y,w,h)))}}       battler.dispose       battler = bitmap2     end     self.contents.blt(x, y, battler, Rect.new(0, 0, [w,h].max,[w,h].max))    end 
 
 #--------------------------------------------------------------------------  
  # ● 战斗图形的描绘  
  #     actor : 角色  
  #     x     : 描画目标 X 坐标  
  #     y     : 描画目标 Y 坐标  
  #--------------------------------------------------------------------------  
  def draw_battler_graphic(actor, x, y)   
    battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)  
    w = battler.width  
    h = battler.height  
    if defined? yield  
      bitmap2 = Bitmap.new(battler.height, battler.width)  
      h.times{|x|w.times{|y|bitmap2.set_pixel(x, y, battler.get_pixel(*yield(x,y,w,h)))}}  
      battler.dispose  
      battler = bitmap2  
    end  
    self.contents.blt(x, y, battler, Rect.new(0, 0, [w,h].max,[w,h].max))   
  end  
 
  
这是战斗图的绘制,使用了set/get_pixel,所以效率较低,高级点的什么就不会了,正在学习. 
还用了迭代。所以调用有些讲究. 
默认的 
draw_battler_graphic(@actor, 50, 80)  
就是不转向, 
    draw_battler_graphic(@actor, 50, 80){|x,y,w,h|[w-y,x]}  
还有 
draw_battler_graphic(@actor, 50, 80){|x,y,w,h|[w-y,h-x]}  
以及 
draw_battler_graphic(@actor, 50, 80){|x,y,w,h|[y,x]}  
最后 
draw_battler_graphic(@actor, 50, 80){|x,y,w,h|[y,h-x]}  
楼主自己试试吧 
 |   
 
评分
- 
查看全部评分
 
 
 
 
 
 |