本帖最后由 89444640 于 2016-7-18 12:50 编辑 首先求教,求会脚本的朋友帮忙把这个远景移动的脚本改一下。万分感谢 这是补的油桶的碎片 http://www.xiami.com/play?ids=/s ... lt/object_id/0#open 果然是不 ...
# ▼▲▼ XRXS34. パノラマスクロール ▼▲▼# by ぷのくー #——————————————————————————————————————# 这是一个非常简单的脚本,只要自定义自动滚动的地图编号和绝对不滚动的地图编号# 即可实现对远景和雾图形的操作。#——————————————————————————————————————#追加雾图形锁定 #追加多种移动方式#by 牛肉面#==============================================================================# 初始化的一些常量#==============================================================================class Game_Map # 远景1横向飘移速度速度 PANORAMA_SX = 40 # 远景1纵向飘移速度速度 PANORAMA_SY = 0 # 自动滚动远景种类1的地图编号 AUTO_SCROLL_PANORAMA_IDS = [82,86] # 远景2横向飘移速度速度 PANORAMA_SX2 = 4 # 远景3纵向飘移速度速度 PANORAMA_SY2 = 2 # 自动滚动远景种类2的地图编号 AUTO_SCROLL_PANORAMA_IDS2 = [46,17,159] # 远景3横向飘移速度速度 PANORAMA_SX3 = 8 # 远景3纵向飘移速度速度 PANORAMA_SY3 = 0 # 自动滚动远景种类3的地图编号 AUTO_SCROLL_PANORAMA_IDS3 = [141]end class Spriteset_Map # 锁定远景的地图编号 SCROLL_FREEZE_PANORAMA_IDS = [95,92,97] # 锁定雾图形的地图编号 SCROLL_FREEZE_FOG_IDS = [112,16,2,20,21,22,91,37,38,39,40,65,137,140] #——说明:如果自动滚动和锁定都包括了某张地图,则该地图不滚动。 #——如果自动滚动和锁定都没有包括某图,则还是会使用默认效果。end #==============================================================================# ■ Game_Map#==============================================================================class Game_Map attr_accessor :panorama_sx attr_accessor :panorama_sy attr_reader :panorama_ox attr_reader :panorama_oy def setup(map_id) @map_id = map_id @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id)) tileset = $data_tilesets[@map.tileset_id] @tileset_name = tileset.tileset_name @autotile_names = tileset.autotile_names @panorama_name = tileset.panorama_name @panorama_hue = tileset.panorama_hue @fog_name = tileset.fog_name @fog_hue = tileset.fog_hue @fog_opacity = tileset.fog_opacity @fog_blend_type = tileset.fog_blend_type @fog_zoom = tileset.fog_zoom @fog_sx = tileset.fog_sx @fog_sy = tileset.fog_sy # =================================== if AUTO_SCROLL_PANORAMA_IDS.include?(map_id) @panorama_sx = PANORAMA_SX @panorama_sy = PANORAMA_SY else if AUTO_SCROLL_PANORAMA_IDS2.include?(map_id) @panorama_sx = PANORAMA_SX2 @panorama_sy = PANORAMA_SY2 else if AUTO_SCROLL_PANORAMA_IDS3.include?(map_id) @panorama_sx = PANORAMA_SX3 @panorama_sy = PANORAMA_SY3 else @panorama_sx = 0 @panorama_sy = 0 end end end # =================================== @battleback_name = tileset.battleback_name @passages = tileset.passages @priorities = tileset.priorities @terrain_tags = tileset.terrain_tags @display_x = 0 @display_y = 0 @need_refresh = false @events = {} for i in @map.events.keys @events[i] = Game_Event.new(@map_id, @map.events[i]) end @common_events = {} for i in 1...$data_common_events.size @common_events[i] = Game_CommonEvent.new(i) end @fog_ox = 0 @fog_oy = 0 @panorama_ox = 0 @panorama_oy = 0 @fog_tone = Tone.new(0, 0, 0, 0) @fog_tone_target = Tone.new(0, 0, 0, 0) @fog_tone_duration = 0 @fog_opacity_duration = 0 @fog_opacity_target = 0 @scroll_direction = 2 @scroll_rest = 0 @scroll_speed = 4 end def update if $game_map.need_refresh refresh end if @scroll_rest > 0 distance = 2 ** @scroll_speed case @scroll_direction when 2 # 下 scroll_down(distance) when 4 # 左 scroll_left(distance) when 6 # 右 scroll_right(distance) when 8 # 上 scroll_up(distance) end @scroll_rest -= distance end for event in @events.values event.update end for common_event in @common_events.values common_event.update end @fog_ox -= @fog_sx / 8.0 @fog_oy -= @fog_sy / 8.0 # =================================== @panorama_ox -= @panorama_sx / 8.0 @panorama_oy -= @panorama_sy / 8.0 # =================================== if @fog_tone_duration >= 1 d = @fog_tone_duration target = @fog_tone_target @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d @fog_tone_duration -= 1 end if @fog_opacity_duration >= 1 d = @fog_opacity_duration @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d @fog_opacity_duration -= 1 end endend #==============================================================================# ■ Spriteset_Map#==============================================================================class Spriteset_Map def update if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue @panorama_name = $game_map.panorama_name @panorama_hue = $game_map.panorama_hue if @panorama.bitmap != nil @panorama.bitmap.dispose @panorama.bitmap = nil end if @panorama_name != "" @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue) end Graphics.frame_reset end if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue @fog_name = $game_map.fog_name @fog_hue = $game_map.fog_hue if @fog.bitmap != nil @fog.bitmap.dispose @fog.bitmap = nil end if @fog_name != "" @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue) end Graphics.frame_reset end @tilemap.ox = $game_map.display_x / 4 @tilemap.oy = $game_map.display_y / 4 2.times {@tilemap.update} # =================================== if SCROLL_FREEZE_PANORAMA_IDS.include?($game_map.map_id) @panorama.ox = 0 @panorama.oy = 0 else @panorama.ox = $game_map.display_x / 8 +$game_map.panorama_ox @panorama.oy = $game_map.display_y / 8 +$game_map.panorama_oy end # =================================== @fog.zoom_x = $game_map.fog_zoom / 100.0 @fog.zoom_y = $game_map.fog_zoom / 100.0 @fog.opacity = $game_map.fog_opacity @fog.blend_type = $game_map.fog_blend_type if SCROLL_FREEZE_FOG_IDS.include?($game_map.map_id) @fog.ox = 0 @fog.oy = 0 else @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy end @fog.tone = $game_map.fog_tone for sprite in @character_sprites sprite.update end @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.ox = $game_map.display_x / 4 @weather.oy = $game_map.display_y / 4 @weather.update for sprite in @picture_sprites sprite.update end @timer_sprite.update @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake @viewport3.color = $game_screen.flash_color @viewport1.update @viewport3.update endend
# ▼▲▼ XRXS34. パノラマスクロール ▼▲▼ # by ぷのくー #—————————————————————————————————————— # 这是一个非常简单的脚本,只要自定义自动滚动的地图编号和绝对不滚动的地图编号 # 即可实现对远景和雾图形的操作。 #—————————————————————————————————————— #追加雾图形锁定 #追加多种移动方式 #by 牛肉面 #============================================================================== # 初始化的一些常量 #============================================================================== class Game_Map # 远景1横向飘移速度速度 PANORAMA_SX = 40 # 远景1纵向飘移速度速度 PANORAMA_SY = 0 # 自动滚动远景种类1的地图编号 AUTO_SCROLL_PANORAMA_IDS = [82,86] # 远景2横向飘移速度速度 PANORAMA_SX2 = 4 # 远景3纵向飘移速度速度 PANORAMA_SY2 = 2 # 自动滚动远景种类2的地图编号 AUTO_SCROLL_PANORAMA_IDS2 = [46,17,159] # 远景3横向飘移速度速度 PANORAMA_SX3 = 8 # 远景3纵向飘移速度速度 PANORAMA_SY3 = 0 # 自动滚动远景种类3的地图编号 AUTO_SCROLL_PANORAMA_IDS3 = [141] end class Spriteset_Map # 锁定远景的地图编号 SCROLL_FREEZE_PANORAMA_IDS = [95,92,97] # 锁定雾图形的地图编号 SCROLL_FREEZE_FOG_IDS = [112,16,2,20,21,22,91,37,38,39,40,65,137,140] #——说明:如果自动滚动和锁定都包括了某张地图,则该地图不滚动。 #——如果自动滚动和锁定都没有包括某图,则还是会使用默认效果。 end #============================================================================== # ■ Game_Map #============================================================================== class Game_Map attr_accessor :panorama_sx attr_accessor :panorama_sy attr_reader :panorama_ox attr_reader :panorama_oy def setup(map_id) @map_id = map_id @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id)) tileset = $data_tilesets[@map.tileset_id] @tileset_name = tileset.tileset_name @autotile_names = tileset.autotile_names @panorama_name = tileset.panorama_name @panorama_hue = tileset.panorama_hue @fog_name = tileset.fog_name @fog_hue = tileset.fog_hue @fog_opacity = tileset.fog_opacity @fog_blend_type = tileset.fog_blend_type @fog_zoom = tileset.fog_zoom @fog_sx = tileset.fog_sx @fog_sy = tileset.fog_sy # =================================== if AUTO_SCROLL_PANORAMA_IDS.include?(map_id) @panorama_sx = PANORAMA_SX @panorama_sy = PANORAMA_SY else if AUTO_SCROLL_PANORAMA_IDS2.include?(map_id) @panorama_sx = PANORAMA_SX2 @panorama_sy = PANORAMA_SY2 else if AUTO_SCROLL_PANORAMA_IDS3.include?(map_id) @panorama_sx = PANORAMA_SX3 @panorama_sy = PANORAMA_SY3 else @panorama_sx = 0 @panorama_sy = 0 end end end # =================================== @battleback_name = tileset.battleback_name @passages = tileset.passages @priorities = tileset.priorities @terrain_tags = tileset.terrain_tags @display_x = 0 @display_y = 0 @need_refresh = false @events = {} for i in @map.events.keys @events[i] = Game_Event.new(@map_id, @map.events[i]) end @common_events = {} for i in 1...$data_common_events.size @common_events[i] = Game_CommonEvent.new(i) end @fog_ox = 0 @fog_oy = 0 @panorama_ox = 0 @panorama_oy = 0 @fog_tone = Tone.new(0, 0, 0, 0) @fog_tone_target = Tone.new(0, 0, 0, 0) @fog_tone_duration = 0 @fog_opacity_duration = 0 @fog_opacity_target = 0 @scroll_direction = 2 @scroll_rest = 0 @scroll_speed = 4 end def update if $game_map.need_refresh refresh end if @scroll_rest > 0 distance = 2 ** @scroll_speed case @scroll_direction when 2 # 下 scroll_down(distance) when 4 # 左 scroll_left(distance) when 6 # 右 scroll_right(distance) when 8 # 上 scroll_up(distance) end @scroll_rest -= distance end for event in @events.values event.update end for common_event in @common_events.values common_event.update end @fog_ox -= @fog_sx / 8.0 @fog_oy -= @fog_sy / 8.0 # =================================== @panorama_ox -= @panorama_sx / 8.0 @panorama_oy -= @panorama_sy / 8.0 # =================================== if @fog_tone_duration >= 1 d = @fog_tone_duration target = @fog_tone_target @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d @fog_tone_duration -= 1 end if @fog_opacity_duration >= 1 d = @fog_opacity_duration @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d @fog_opacity_duration -= 1 end end end #============================================================================== # ■ Spriteset_Map #============================================================================== class Spriteset_Map def update if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue @panorama_name = $game_map.panorama_name @panorama_hue = $game_map.panorama_hue if @panorama.bitmap != nil @panorama.bitmap.dispose @panorama.bitmap = nil end if @panorama_name != "" @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue) end Graphics.frame_reset end if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue @fog_name = $game_map.fog_name @fog_hue = $game_map.fog_hue if @fog.bitmap != nil @fog.bitmap.dispose @fog.bitmap = nil end if @fog_name != "" @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue) end Graphics.frame_reset end @tilemap.ox = $game_map.display_x / 4 @tilemap.oy = $game_map.display_y / 4 2.times {@tilemap.update} # =================================== if SCROLL_FREEZE_PANORAMA_IDS.include?($game_map.map_id) @panorama.ox = 0 @panorama.oy = 0 else @panorama.ox = $game_map.display_x / 8 +$game_map.panorama_ox @panorama.oy = $game_map.display_y / 8 +$game_map.panorama_oy end # =================================== @fog.zoom_x = $game_map.fog_zoom / 100.0 @fog.zoom_y = $game_map.fog_zoom / 100.0 @fog.opacity = $game_map.fog_opacity @fog.blend_type = $game_map.fog_blend_type if SCROLL_FREEZE_FOG_IDS.include?($game_map.map_id) @fog.ox = 0 @fog.oy = 0 else @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy end @fog.tone = $game_map.fog_tone for sprite in @character_sprites sprite.update end @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.ox = $game_map.display_x / 4 @weather.oy = $game_map.display_y / 4 @weather.update for sprite in @picture_sprites sprite.update end @timer_sprite.update @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake @viewport3.color = $game_screen.flash_color @viewport1.update @viewport3.update end end
查看全部评分
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-24 01:48
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.