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

Project1

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

[已经解决] 战斗移位

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2010-8-1
帖子
11
跳转到指定楼层
1
发表于 2010-8-1 09:58:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
请问各位前辈,战斗中移位是怎么做到的,需要脚本吗?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2009-7-29
帖子
53
2
发表于 2010-8-1 10:34:44 | 只看该作者
  1. class Bitmap
  2.   def draw_number(x, y, number,o,picture = RPG::Cache.system("number"))
  3.     w = picture.width / 10
  4.     h = picture.height / 5
  5.     rect = Rect.new(0,0,w,h)
  6.     number = number.to_s
  7.     array = number.split(//)
  8.     for i in 0...array.size
  9.       array[i] = array[i].to_i
  10.     end
  11.     case o
  12.     when 1
  13.       x += 81 - (array.size * 9)
  14.     when 2
  15.     end
  16.     if number == "Miss"
  17.       self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h))
  18.       return
  19.     end
  20.     for sz in array
  21.       rect.x = sz * w
  22.       self.blt(x,y,picture,rect)
  23.       x += w
  24.     end
  25.   end
  26. end
  27. module RPG
  28.   class Sprite < ::Sprite
  29.     def damage(value, critical)
  30.       dispose_damage
  31.       if value.is_a?(Numeric)
  32.         damage_string = value.abs.to_s
  33.       else
  34.         damage_string = value.to_s
  35.       end
  36.       bitmap = Bitmap.new(160, 48)
  37.       bitmap.font.name = "Arial Black"
  38.       bitmap.font.size = 32
  39.       if value.is_a?(Numeric) and value < 0
  40.         bitmap.font.color.set(176, 255, 144)
  41.       else
  42.         bitmap.font.color.set(255, 255, 255)
  43.       end
  44.       bitmap.draw_number(0, 12, damage_string,1)
  45.       if critical
  46.         bitmap.font.size = 20
  47.         bitmap.font.color.set(0, 0, 0)
  48.         bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  49.         bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  50.         bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  51.         bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  52.         bitmap.font.color.set(255, 255, 255)
  53.         bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  54.       end
  55.       @_damage_sprite = ::Sprite.new(self.viewport)
  56.       @_damage_sprite.bitmap = bitmap
  57.       @_damage_sprite.ox = 80
  58.       @_damage_sprite.oy = 20
  59.       @_damage_sprite.x = self.x
  60.       @_damage_sprite.y = self.y - self.oy / 2
  61.       @_damage_sprite.z = 3000
  62.       @_damage_duration = 40
  63.     end
  64.     def dispose_animation
  65.       if @_animation_sprites != nil
  66.         sprite = @_animation_sprites[0]
  67.         #if sprite != nil
  68.         #  @@_reference_count[sprite.bitmap] -= 1
  69.         #  if @@_reference_count[sprite.bitmap] == 0
  70.         #    sprite.bitmap.dispose
  71.         #  end
  72.         #end
  73.         for sprite in @_animation_sprites
  74.           sprite.dispose
  75.         end
  76.         @_animation_sprites = nil
  77.         @_animation = nil
  78.       end
  79.     end
  80.   end
  81. end
复制代码

评分

参与人数 1星屑 +200 收起 理由
「旅」 + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 03:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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