Project1

标题: 怎么显示一张图片在行走图"下面" [打印本页]

作者: 刺夜之枪    时间: 2012-1-7 23:33
标题: 怎么显示一张图片在行走图"下面"
本帖最后由 刺夜之枪 于 2012-1-9 20:03 编辑

RT,这个下面是说让NPC士兵脚底下踩着个光环(即时战略的的士兵都有的光环)
总之不能用PS,哪有什么办法。
注意,只有指定的事件脚下才能有。。。dsu_plus_rewardpost_czw
作者: 傲视群雄    时间: 2012-1-8 02:10
可以设置动画
显示某个事件 播放动画
用自定义设置等待与开关 这样就可以做到炫光的效果
作者: Wind2010    时间: 2012-1-8 09:14
这样的话或者需要改Game_Character,在里面再加一个Bitmap来描绘
作者: px.凤翔九天    时间: 2012-1-8 09:30
貌似也可以在scene_map中加个监视事件位置的处理然后跟随他播放动画光环或者图片光环。
作者: 刺夜之枪    时间: 2012-1-8 10:19
具体步骤求指示,脚本什么的不会
作者: 众神与将军    时间: 2012-1-8 21:00
用PS在士兵脚下加光圈
作者: CockyGuy    时间: 2012-1-8 21:43
本帖最后由 CockyGuy 于 2012-1-9 21:31 编辑

首先在Main之前插入脚本:
  1. #==============================================================================
  2. # ■ Spriteset_Map
  3. #------------------------------------------------------------------------------
  4. #  处理地图画面活动块和元件的类。本类在
  5. # Scene_Map 类的内部使用。
  6. #==============================================================================

  7. class Spriteset_Map
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     # 生成显示端口
  13.     @viewport1 = Viewport.new(0, 0, 640, 480)
  14.     @viewport2 = Viewport.new(0, 0, 640, 480)
  15.     @viewport3 = Viewport.new(0, 0, 640, 480)
  16.     @viewport2.z = 200
  17.     @viewport3.z = 5000
  18.     # 生成元件地图
  19.     @tilemap = Tilemap.new(@viewport1)
  20.     @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
  21.     for i in 0..6
  22.       autotile_name = $game_map.autotile_names[i]
  23.       @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
  24.     end
  25.     @tilemap.map_data = $game_map.data
  26.     @tilemap.priorities = $game_map.priorities
  27.     # 生成远景平面
  28.     @panorama = Plane.new(@viewport1)
  29.     @panorama.z = -1000
  30.     # 生成雾平面
  31.     @fog = Plane.new(@viewport1)
  32.     @fog.z = 3000
  33.     # 生成角色活动块
  34.     @character_sprites = []
  35.     for i in $game_map.events.keys.sort
  36.       sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
  37.       if not sprite.character.ring.empty?
  38.         ring = BrightRing.new(@viewport1,sprite.character)
  39.         @character_sprites.push(ring)
  40.       end
  41.       @character_sprites.push(sprite)
  42.     end
  43.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  44.     # 生成天气
  45.     @weather = RPG::Weather.new(@viewport1)
  46.     # 生成图片
  47.     @picture_sprites = []
  48.     for i in 1..50
  49.       @picture_sprites.push(Sprite_Picture.new(@viewport2,
  50.         $game_screen.pictures[i]))
  51.     end
  52.     # 生成计时器块
  53.     @timer_sprite = Sprite_Timer.new
  54.     # 刷新画面
  55.     update
  56.   end
  57. end
复制代码
再在Main前插入一个脚本(这俩可以放一起,随便。)
  1. class BrightRing < RPG::Sprite
  2.   attr_accessor :offset_x
  3.   attr_accessor :offset_y
  4.   attr_accessor :character
  5.   def initialize(viewport, character = nil)
  6.     super(viewport)
  7.     self.character = character
  8.     @offset_x = 0
  9.     @offset_y = 0
  10.     self.visible = true
  11.     self.z = 9
  12.     self.bitmap = RPG::Cache.picture(character.ring)
  13.   end
  14.   def update()
  15.     x = (character.real_x - $game_map.display_x + 3) / 4
  16.     y = (character.real_y - $game_map.display_y + 3) / 4
  17.     adjust_offset(x, y)
  18.     self.x = x + @offset_x
  19.     self.y = y + @offset_y
  20.   end
  21.   def change_ring(bitmap)
  22.     self.bitmap =  bitmap
  23.   end
  24.   def hide_ring
  25.     self.visible = false
  26.   end
  27.   def show_ring
  28.     self.visible = true
  29.   end
  30.   def adjust_offset(x, y)
  31.     @offset_x = 16 - (self.bitmap.width / 2)
  32.     @offset_y = 16 - (self.bitmap.height / 2)
  33.   end
  34. end

  35. class Game_Character
  36.   attr_accessor :ring
  37.   alias   :ori_character_initialize   :initialize
  38.   def initialize
  39.     @ring = ''
  40.     ori_character_initialize
  41.   end
  42. end
  43. class Game_Event < Game_Character
  44.   alias   :ori_event_initialize   :initialize
  45.   def initialize(map_id, event)
  46.     ori_event_initialize(map_id, event)
  47.     ring_initialize
  48.   end
  49.   def ring_initialize
  50.     command = @event.pages[0].list[0]
  51.     if command.code == 108 and command.parameters[0][0] == 64
  52.       @ring = command.parameters[0][1,command.parameters[0].size - 1]
  53.     end
  54.   end
  55. end
复制代码
将你的"光环"素材保存在Graphics/Pictures文件夹,例如文件名为11.png。
在你想要显示这个光环的事件的【事件页】第一页第一个事件必须是注释。内容是
  1. @素材名
复制代码
在本例子中就是
  1. @11
复制代码
======================================
[@]刺夜之枪[/@]
图片跟着事件走。
变成尸体后在【设置移动路线】事件中调用脚本
  1. self.brightring.hide_ring
复制代码
光环就没了。
额,写的仓促脚本有点缺陷……默认我这个是自动跟踪事件移动的,如果想要小改位置貌似访问不到……
������������




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