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

Project1

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

[已经解决] 求人帮我修改下这个双远景图脚本

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
181 小时
注册时间
2010-7-20
帖子
347
跳转到指定楼层
1
发表于 2011-7-22 23:16:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
帮我把这个双远景图的脚本改成两张图都在角色下方的.也是在地图下方的。原来的是一张是在角色下方.一张是在角色上方。两个远景图都在下方。而且还要两个远景图移动的方式不同。比如第一张斜着移动.第二章横着移动


#==============================================================================
# ■ Spriteset_Map(自己根据xp版的修改)
#------------------------------------------------------------------------------
#  处理地图画面活动块和元件的类。本类在
# Scene_Map 类的内部使用。
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    create_viewports
    create_tilemap
    create_parallax
    create_characters
    create_shadow
    create_weather
    create_pictures
    create_timer
    update
  end
  #--------------------------------------------------------------------------
  # ● 生成视区
  #--------------------------------------------------------------------------
  def create_viewports
    @viewport1 = Viewport.new(0, 0, 544, 416)
    @viewport2 = Viewport.new(0, 0, 544, 416)
    @viewport3 = Viewport.new(0, 0, 544, 416)
    @viewport2.z = 50
    @viewport3.z = 100
  end
  #--------------------------------------------------------------------------
  # ● 生成元件图
  #--------------------------------------------------------------------------
  def create_tilemap
    @tilemap = Tilemap.new(@viewport1)
    @tilemap.bitmaps[0] = Cache.system("TileA1")
    @tilemap.bitmaps[1] = Cache.system("TileA2")
    @tilemap.bitmaps[2] = Cache.system("TileA3")
    @tilemap.bitmaps[3] = Cache.system("TileA4")
    @tilemap.bitmaps[4] = Cache.system("TileA5")
    @tilemap.bitmaps[5] = Cache.system("TileB")
    @tilemap.bitmaps[6] = Cache.system("TileC")
    @tilemap.bitmaps[7] = Cache.system("TileD")
    @tilemap.bitmaps[8] = Cache.system("TileE")
    @tilemap.map_data = $game_map.data
    @tilemap.passages = $game_map.passages
  end
  #--------------------------------------------------------------------------
  # ● 生成远景
  #--------------------------------------------------------------------------
  def create_parallax
    @parallax = Plane.new(@viewport1)
    @parallax.z = -100
    @parallax2 = Plane.new(@viewport1)
    @parallax2.z = 300
  end
  #--------------------------------------------------------------------------
  # ● 生成角色活动块
  #--------------------------------------------------------------------------
  def create_characters
    @character_sprites = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites.push(sprite)
    end
    for vehicle in $game_map.vehicles
      sprite = Sprite_Character.new(@viewport1, vehicle)
      @character_sprites.push(sprite)
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  end
  #--------------------------------------------------------------------------
  # ● 生成飞行船阴影活动块
  #--------------------------------------------------------------------------
  def create_shadow
    @shadow_sprite = Sprite.new(@viewport1)
    @shadow_sprite.bitmap = Cache.system("Shadow")
    @shadow_sprite.ox = @shadow_sprite.bitmap.width / 2
    @shadow_sprite.oy = @shadow_sprite.bitmap.height
    @shadow_sprite.z = 180
  end
  #--------------------------------------------------------------------------
  # ● 生成天气
  #--------------------------------------------------------------------------
  def create_weather
    @weather = Spriteset_Weather.new(@viewport2)
  end
  #--------------------------------------------------------------------------
  # ● 生成位图活动块
  #--------------------------------------------------------------------------
  def create_pictures
    @picture_sprites = []
    for i in 1..20
      @picture_sprites.push(Sprite_Picture.new(@viewport2,
        $game_map.screen.pictures[i]))
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成计时器活动块
  #--------------------------------------------------------------------------
  def create_timer
    @timer_sprite = Sprite_Timer.new(@viewport2)
  end
  #--------------------------------------------------------------------------
  # ● 释放
  #--------------------------------------------------------------------------
  def dispose
    dispose_tilemap
    dispose_parallax
    dispose_characters
    dispose_shadow
    dispose_weather
    dispose_pictures
    dispose_timer
    dispose_viewports
  end
  #--------------------------------------------------------------------------
  # ● 释放元件图
  #--------------------------------------------------------------------------
  def dispose_tilemap
    @tilemap.dispose
  end
  #--------------------------------------------------------------------------
  # ● 释放远景
  #--------------------------------------------------------------------------
  def dispose_parallax
    @parallax.dispose
    @parallax2.dispose
  end
  #--------------------------------------------------------------------------
  # ● 释放角色活动块
  #--------------------------------------------------------------------------
  def dispose_characters
    for sprite in @character_sprites
      sprite.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ● 释放飞行船阴影活动块
  #--------------------------------------------------------------------------
  def dispose_shadow
    @shadow_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 释放天气
  #--------------------------------------------------------------------------
  def dispose_weather
    @weather.dispose
  end
  #--------------------------------------------------------------------------
  # ● 释放位图活动块
  #--------------------------------------------------------------------------
  def dispose_pictures
    for sprite in @picture_sprites
      sprite.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ● 释放计时器活动块
  #--------------------------------------------------------------------------
  def dispose_timer
    @timer_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 释放视区
  #--------------------------------------------------------------------------
  def dispose_viewports
    @viewport1.dispose
    @viewport2.dispose
    @viewport3.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    update_tilemap
    update_parallax
    update_characters
    update_shadow
    update_weather
    update_pictures
    update_timer
    update_viewports
  end
  #--------------------------------------------------------------------------
  # ● 刷新元件图
  #--------------------------------------------------------------------------
  def update_tilemap
    @tilemap.ox = $game_map.display_x / 8
    @tilemap.oy = $game_map.display_y / 8
    @tilemap.update
  end
  #--------------------------------------------------------------------------
  # ● 刷新远景
  #--------------------------------------------------------------------------
  def update_parallax
    if @parallax_name != $game_map.parallax_name
      @parallax_name = $game_map.parallax_name
      if @parallax.bitmap != nil
         @parallax.bitmap.dispose
         @parallax2.bitmap.dispose
         @parallax2.bitmap = nil
         @parallax.bitmap = nil
      end
      if @parallax_name != ""
         @parallax.bitmap = Cache.parallax(@parallax_name)
         @parallax2.bitmap = Cache.parallax(@parallax_name+"_2")
      end
      Graphics.frame_reset
     end
    @parallax.ox = $game_map.calc_parallax_x(@parallax.bitmap)
    @parallax.oy = $game_map.calc_parallax_y(@parallax.bitmap)
    @parallax2.ox = $game_map.calc_parallax_x(@parallax.bitmap)
    @parallax2.oy = $game_map.calc_parallax_y(@parallax.bitmap)
  end
  #--------------------------------------------------------------------------
  # ● 刷新角色活动块
  #--------------------------------------------------------------------------
  def update_characters
    for sprite in @character_sprites
      sprite.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新飞行船阴影活动块
  #--------------------------------------------------------------------------
  def update_shadow
    airship = $game_map.airship
    @shadow_sprite.x = airship.screen_x
    @shadow_sprite.y = airship.screen_y + airship.altitude
    @shadow_sprite.opacity = airship.altitude * 8
    @shadow_sprite.update
  end
  #--------------------------------------------------------------------------
  # ● 刷新天气
  #--------------------------------------------------------------------------
  def update_weather
    @weather.type = $game_map.screen.weather_type
    @weather.max = $game_map.screen.weather_max
    @weather.ox = $game_map.display_x / 8
    @weather.oy = $game_map.display_y / 8
    @weather.update
  end
  #--------------------------------------------------------------------------
  # ● 刷新活动块位图
  #--------------------------------------------------------------------------
  def update_pictures
    for sprite in @picture_sprites
      sprite.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新计时器位图
  #--------------------------------------------------------------------------
  def update_timer
    @timer_sprite.update
  end
  #--------------------------------------------------------------------------
  # ● 刷新视区
  #--------------------------------------------------------------------------
  def update_viewports
    @viewport1.tone = $game_map.screen.tone
    @viewport1.ox = $game_map.screen.shake
    @viewport2.color = $game_map.screen.flash_color
    @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
    @viewport1.update
    @viewport2.update
    @viewport3.update
  end
end

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1071 小时
注册时间
2011-5-12
帖子
2317

贵宾

2
发表于 2011-7-23 09:02:28 | 只看该作者
这已经算是伸手了吧……至少自己努力试试?
下次脚本用代码装起来啊啊~
3远景图脚本:
  1. #==============================================================================
  2. # ■ Spriteset_Map(自己根据xp版的修改)
  3. #------------------------------------------------------------------------------
  4. #  处理地图画面活动块和元件的类。本类在
  5. # Scene_Map 类的内部使用。
  6. #==============================================================================

  7. class Spriteset_Map
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对象
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     create_viewports
  13.     create_tilemap
  14.     create_parallax
  15.     create_characters
  16.     create_shadow
  17.     create_weather
  18.     create_pictures
  19.     create_timer
  20.     update
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 生成视区
  24.   #--------------------------------------------------------------------------
  25.   def create_viewports
  26.     @viewport1 = Viewport.new(0, 0, 544, 416)
  27.     @viewport2 = Viewport.new(0, 0, 544, 416)
  28.     @viewport3 = Viewport.new(0, 0, 544, 416)
  29.     @viewport2.z = 50
  30.     @viewport3.z = 100
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 生成元件图
  34.   #--------------------------------------------------------------------------
  35.   def create_tilemap
  36.     @tilemap = Tilemap.new(@viewport1)
  37.     @tilemap.bitmaps[0] = Cache.system("TileA1")
  38.     @tilemap.bitmaps[1] = Cache.system("TileA2")
  39.     @tilemap.bitmaps[2] = Cache.system("TileA3")
  40.     @tilemap.bitmaps[3] = Cache.system("TileA4")
  41.     @tilemap.bitmaps[4] = Cache.system("TileA5")
  42.     @tilemap.bitmaps[5] = Cache.system("TileB")
  43.     @tilemap.bitmaps[6] = Cache.system("TileC")
  44.     @tilemap.bitmaps[7] = Cache.system("TileD")
  45.     @tilemap.bitmaps[8] = Cache.system("TileE")
  46.     @tilemap.map_data = $game_map.data
  47.     @tilemap.passages = $game_map.passages
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 生成远景
  51.   #--------------------------------------------------------------------------
  52.   def create_parallax
  53.     @parallax = Plane.new(@viewport1)
  54.     @parallax.z = -100
  55.     @parallax1 = Plane.new(@viewport1)
  56.     @parallax1.z = 200
  57.     @parallax2 = Plane.new(@viewport1)
  58.     @parallax2.z = 300
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 生成角色活动块
  62.   #--------------------------------------------------------------------------
  63.   def create_characters
  64.     @character_sprites = []
  65.     for i in $game_map.events.keys.sort
  66.       sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
  67.       @character_sprites.push(sprite)
  68.     end
  69.     for vehicle in $game_map.vehicles
  70.       sprite = Sprite_Character.new(@viewport1, vehicle)
  71.       @character_sprites.push(sprite)
  72.     end
  73.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 生成飞行船阴影活动块
  77.   #--------------------------------------------------------------------------
  78.   def create_shadow
  79.     @shadow_sprite = Sprite.new(@viewport1)
  80.     @shadow_sprite.bitmap = Cache.system("Shadow")
  81.     @shadow_sprite.ox = @shadow_sprite.bitmap.width / 2
  82.     @shadow_sprite.oy = @shadow_sprite.bitmap.height
  83.     @shadow_sprite.z = 180
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 生成天气
  87.   #--------------------------------------------------------------------------
  88.   def create_weather
  89.     @weather = Spriteset_Weather.new(@viewport2)
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 生成位图活动块
  93.   #--------------------------------------------------------------------------
  94.   def create_pictures
  95.     @picture_sprites = []
  96.     for i in 1..20
  97.       @picture_sprites.push(Sprite_Picture.new(@viewport2,
  98.         $game_map.screen.pictures[i]))
  99.     end
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 生成计时器活动块
  103.   #--------------------------------------------------------------------------
  104.   def create_timer
  105.     @timer_sprite = Sprite_Timer.new(@viewport2)
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 释放
  109.   #--------------------------------------------------------------------------
  110.   def dispose
  111.     dispose_tilemap
  112.     dispose_parallax
  113.     dispose_characters
  114.     dispose_shadow
  115.     dispose_weather
  116.     dispose_pictures
  117.     dispose_timer
  118.     dispose_viewports
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 释放元件图
  122.   #--------------------------------------------------------------------------
  123.   def dispose_tilemap
  124.     @tilemap.dispose
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 释放远景
  128.   #--------------------------------------------------------------------------
  129.   def dispose_parallax
  130.     @parallax.dispose
  131.     @parallax1.dispose
  132.     @parallax2.dispose
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 释放角色活动块
  136.   #--------------------------------------------------------------------------
  137.   def dispose_characters
  138.     for sprite in @character_sprites
  139.       sprite.dispose
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 释放飞行船阴影活动块
  144.   #--------------------------------------------------------------------------
  145.   def dispose_shadow
  146.     @shadow_sprite.dispose
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 释放天气
  150.   #--------------------------------------------------------------------------
  151.   def dispose_weather
  152.     @weather.dispose
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 释放位图活动块
  156.   #--------------------------------------------------------------------------
  157.   def dispose_pictures
  158.     for sprite in @picture_sprites
  159.       sprite.dispose
  160.     end
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 释放计时器活动块
  164.   #--------------------------------------------------------------------------
  165.   def dispose_timer
  166.     @timer_sprite.dispose
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 释放视区
  170.   #--------------------------------------------------------------------------
  171.   def dispose_viewports
  172.     @viewport1.dispose
  173.     @viewport2.dispose
  174.     @viewport3.dispose
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 刷新画面
  178.   #--------------------------------------------------------------------------
  179.   def update
  180.     update_tilemap
  181.     update_parallax
  182.     update_characters
  183.     update_shadow
  184.     update_weather
  185.     update_pictures
  186.     update_timer
  187.     update_viewports
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 刷新元件图
  191.   #--------------------------------------------------------------------------
  192.   def update_tilemap
  193.     @tilemap.ox = $game_map.display_x / 8
  194.     @tilemap.oy = $game_map.display_y / 8
  195.     @tilemap.update
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 刷新远景
  199.   #--------------------------------------------------------------------------
  200.   def update_parallax
  201.     if @parallax_name != $game_map.parallax_name
  202.       @parallax_name = $game_map.parallax_name
  203.       if @parallax.bitmap != nil
  204.          @parallax.bitmap.dispose
  205.          @parallax1.bitmap.dispose
  206.          @parallax2.bitmap.dispose
  207.          @parallax2.bitmap = nil
  208.          @parallax1.bitmap = nil
  209.          @parallax.bitmap = nil
  210.       end
  211.       if @parallax_name != ""
  212.          @parallax.bitmap = Cache.parallax(@parallax_name)
  213.          @parallax1.bitmap = Cache.parallax(@parallax_name+"_1")
  214.          @parallax2.bitmap = Cache.parallax(@parallax_name+"_2")
  215.       end
  216.       Graphics.frame_reset
  217.      end
  218.     @parallax.ox = $game_map.calc_parallax_x(@parallax.bitmap)
  219.     @parallax.oy = $game_map.calc_parallax_y(@parallax.bitmap)
  220.     @parallax1.ox = $game_map.calc_parallax_x(@parallax.bitmap)
  221.     @parallax1.oy = $game_map.calc_parallax_y(@parallax.bitmap)
  222.     @parallax2.ox = $game_map.calc_parallax_x(@parallax.bitmap)
  223.     @parallax2.oy = $game_map.calc_parallax_y(@parallax.bitmap)
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 刷新角色活动块
  227.   #--------------------------------------------------------------------------
  228.   def update_characters
  229.     for sprite in @character_sprites
  230.       sprite.update
  231.     end
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● 刷新飞行船阴影活动块
  235.   #--------------------------------------------------------------------------
  236.   def update_shadow
  237.     airship = $game_map.airship
  238.     @shadow_sprite.x = airship.screen_x
  239.     @shadow_sprite.y = airship.screen_y + airship.altitude
  240.     @shadow_sprite.opacity = airship.altitude * 8
  241.     @shadow_sprite.update
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 刷新天气
  245.   #--------------------------------------------------------------------------
  246.   def update_weather
  247.     @weather.type = $game_map.screen.weather_type
  248.     @weather.max = $game_map.screen.weather_max
  249.     @weather.ox = $game_map.display_x / 8
  250.     @weather.oy = $game_map.display_y / 8
  251.     @weather.update
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 刷新活动块位图
  255.   #--------------------------------------------------------------------------
  256.   def update_pictures
  257.     for sprite in @picture_sprites
  258.       sprite.update
  259.     end
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 刷新计时器位图
  263.   #--------------------------------------------------------------------------
  264.   def update_timer
  265.     @timer_sprite.update
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 刷新视区
  269.   #--------------------------------------------------------------------------
  270.   def update_viewports
  271.     @viewport1.tone = $game_map.screen.tone
  272.     @viewport1.ox = $game_map.screen.shake
  273.     @viewport2.color = $game_map.screen.flash_color
  274.     @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
  275.     @viewport1.update
  276.     @viewport2.update
  277.     @viewport3.update
  278.   end
  279. end
复制代码
至于你说的第一张斜着移动.第二章横着移动……啥意思?

点评

就是类似战机的那种远景那样移动呗  发表于 2011-7-26 23:46
找我请找芙蕾娅
顺带一提,完全看得懂我头像请捡起你自己的节操哟(自重
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-11 00:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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