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

Project1

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

麻烦修改下脚本

 关闭 [复制链接]

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

跳转到指定楼层
1
发表于 2008-1-19 22:04:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
角色下面显示阴影
地图左上方会很怪的出现俩个阴影
脚本:
  1. #=begin
  2. #==============================================================================
  3. # ■ Sprite_Character
  4. #------------------------------------------------------------------------------
  5. #  角色显示用脚本。监视 Game_Character 类的实例、
  6. # 自动变化脚本状态。
  7. #==============================================================================

  8. class Sprite_Character < Sprite_Base
  9.   #--------------------------------------------------------------------------
  10.   # ● 定量
  11.   #--------------------------------------------------------------------------
  12.   BALLOON_WAIT = 12                  # 表情最后帧的等待时间
  13.   #--------------------------------------------------------------------------
  14.   # ● 定义实例变量
  15.   #--------------------------------------------------------------------------
  16.   attr_accessor :character
  17.   #--------------------------------------------------------------------------
  18.   # ● 初始化对像
  19.   #     viewport  : 视口
  20.   #     character : 角色 (Game_Character)
  21.   #--------------------------------------------------------------------------
  22.   def initialize(viewport, character = nil)
  23.     @character = character
  24.     singer = @character.character_name[/!/]
  25.     if @character.character_name != "" and singer == nil
  26.     @scr = Sprite.new(viewport)
  27.     @scr.bitmap = Cache.system("WALK")
  28.     @scr.bitmap.blur
  29.     @scr.bitmap.blur
  30.     end

  31.     super(viewport)
  32.     @balloon_duration = 0
  33.     update
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 释放
  37.   #--------------------------------------------------------------------------
  38.   def dispose
  39.     singer = @character.character_name[/!/]
  40.     if @character.character_name != "" and singer == nil
  41. #    @scr.dispose
  42.     @scr = nil
  43.     end
  44.     dispose_balloon
  45.     super
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 刷新画面
  49.   #--------------------------------------------------------------------------
  50.   def update
  51.     super
  52.     update_bitmap
  53.     self.visible = (not @character.transparent)
  54.     update_src_rect
  55.     self.x = @character.screen_x
  56.     self.y = @character.screen_y
  57.     self.z = @character.screen_z
  58.     singer = @character.character_name[/!/]
  59.     if @character.character_name != "" and singer == nil
  60.     @scr.x = @character.screen_x - 40
  61.     @scr.y = @character.screen_y - 35
  62.     @scr.z = @character.screen_z - 2
  63.             @scr.ox = 1
  64.         @scr.oy = 2
  65.     end
  66. #    @scr.width = self.bitmap.width#
  67.     #@scr.height = self.bitmap.height
  68.     self.opacity = @character.opacity
  69.     self.blend_type = @character.blend_type
  70.     self.bush_depth = @character.bush_depth
  71.     update_balloon
  72.     if @character.animation_id != 0
  73.       animation = $data_animations[@character.animation_id]
  74.       start_animation(animation)
  75.       @character.animation_id = 0
  76.     end
  77.     if @character.balloon_id != 0
  78.       @balloon_id = @character.balloon_id
  79.       start_balloon
  80.       @character.balloon_id = 0
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 获取图块图像的指定图块
  85.   #     tile_id : 图块 ID
  86.   #--------------------------------------------------------------------------
  87.   def tileset_bitmap(tile_id)
  88.     set_number = tile_id / 256
  89.     return Cache.system("TileB") if set_number == 0
  90.     return Cache.system("TileC") if set_number == 1
  91.     return Cache.system("TileD") if set_number == 2
  92.     return Cache.system("TileE") if set_number == 3
  93.     return nil
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 刷新传送的位图数据
  97.   #--------------------------------------------------------------------------
  98.   def update_bitmap
  99.     if @tile_id != @character.tile_id or
  100.        @character_name != @character.character_name or
  101.        @character_index != @character.character_index
  102.       @tile_id = @character.tile_id
  103.       @character_name = @character.character_name
  104.       @character_index = @character.character_index
  105.       if @tile_id > 0
  106.         sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
  107.         sy = @tile_id % 256 / 8 % 16 * 32;
  108.         self.bitmap = tileset_bitmap(@tile_id)
  109.         self.src_rect.set(sx, sy, 32, 32)
  110.         self.ox = 16
  111.         self.oy = 32
  112.       else
  113.         self.bitmap = Cache.character(@character_name)
  114.         sign = @character_name[/^[\!\$]./]
  115.         if sign != nil and sign.include?('$')
  116.           @cw = bitmap.width / 3
  117.           @ch = bitmap.height / 4
  118.         else
  119.           @cw = bitmap.width / 12
  120.           @ch = bitmap.height / 8
  121.         end
  122.         self.ox = @cw / 2
  123.         self.oy = @ch
  124.       end
  125.     end
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 刷新传送的矩形数据
  129.   #--------------------------------------------------------------------------
  130.   def update_src_rect
  131.     if @tile_id == 0
  132.       index = @character.character_index
  133.       pattern = @character.pattern < 3 ? @character.pattern : 1
  134.       sx = (index % 4 * 3 + pattern) * @cw
  135.       sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
  136.       self.src_rect.set(sx, sy, @cw, @ch)
  137.     end
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 开始显示表情图标
  141.   #--------------------------------------------------------------------------
  142.   def start_balloon
  143.     dispose_balloon
  144.     @balloon_duration = 8 * 8 + BALLOON_WAIT
  145.     @balloon_sprite = ::Sprite.new(viewport)
  146.     @balloon_sprite.bitmap = Cache.system("Balloon")
  147.     @balloon_sprite.ox = 16
  148.     @balloon_sprite.oy = 32
  149.     update_balloon
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 刷新表情图标
  153.   #--------------------------------------------------------------------------
  154.   def update_balloon
  155.     if @balloon_duration > 0
  156.       @balloon_duration -= 1
  157.       if @balloon_duration == 0
  158.         dispose_balloon
  159.       else
  160.         @balloon_sprite.x = x
  161.         @balloon_sprite.y = y - height
  162.         @balloon_sprite.z = z + 200
  163.         if @balloon_duration < BALLOON_WAIT
  164.           sx = 7 * 32
  165.         else
  166.           sx = (7 - (@balloon_duration - BALLOON_WAIT) / 8) * 32
  167.         end
  168.         sy = (@balloon_id - 1) * 32
  169.         @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  170.       end
  171.     end
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 释放表情图标
  175.   #--------------------------------------------------------------------------
  176.   def dispose_balloon
  177.     if @balloon_sprite != nil
  178.       @balloon_sprite.dispose
  179.       @balloon_sprite = nil
  180.     end
  181.   end
  182. end
  183. #=end
复制代码

版务信息:本贴由楼主自主结贴~
哎呀,蛋疼什么的最有爱了

Lv2.观梦者

梦石
0
星屑
260
在线时间
1373 小时
注册时间
2005-10-16
帖子
5113

贵宾

2
发表于 2008-1-19 22:13:50 | 只看该作者
唔....话说船啊什么的总是要生成的...
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

3
 楼主| 发表于 2008-1-19 22:25:38 | 只看该作者
以下引用亿万星辰于2008-1-19 14:13:50的发言:

唔....话说船啊什么的总是要生成的...

船。。
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

4
 楼主| 发表于 2008-1-19 22:35:39 | 只看该作者
谢谢
#==============================================================================
# ■ Game_Vehicle
#------------------------------------------------------------------------------
#  处理交通工具的类。该类在 Game_Map类的内部使用。
#   当前地图没有交通工具的时,地图坐标设置为 (-1,-1) 。
#==============================================================================
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-1 09:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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