这种效果是当你切换场景时以一种旋转的效果进行的,而且是实时的,
可以用来表现旧照片方式的记忆效果,上一帖中的动态模糊也是利用此
脚本写的,玩角可以根据自已的需要修改脚本,做出更炫的效果。
先上图:
脚本:
- #--------------------------------------------------------------------------# ● 场景旋转切换效果# 制作者 小飞侠_shoed# 用法:# 准备渐变# 开关[旋转切换]=ON# 场所移动# 执行渐变#==============================================================================# ■ Scene_Map#==============================================================================$旋转切换 = 1class Scene_Map #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- alias plan_map_window_main main def main @blur_window = Blur_Effect.new plan_map_window_main @blur_window.dispose end #-------------------------------------------------------------------------- # ● 更新 #-------------------------------------------------------------------------- alias plan_map_window_update update def update # 循环 loop do # 按照地图、实例、主角的顺序刷新 # (本更新顺序不会在满足事件的执行条件下成为给予角色瞬间移动 # 的机会的重要因素) $game_map.update $game_system.map_interpreter.update $game_player.update # 系统 (计时器)、画面刷新 $game_system.update $game_screen.update # 如果主角在场所移动中就中断循环 unless $game_temp.player_transferring break end # 执行场所移动 transfer_player # 处理过渡中的情况下、中断循环 if $game_temp.transition_processing break end end # 刷新活动块 @spriteset.update # 刷新信息窗口 @message_window.update # 游戏结束的情况下 if $game_temp.gameover # 切换的游戏结束画面 $scene = Scene_Gameover.new return end # 返回标题画面的情况下 if $game_temp.to_title # 切换到标题画面 $scene = Scene_Title.new return end # 处理过渡中的情况下 if $game_temp.transition_processing # 清除过渡处理中标志 $game_temp.transition_processing = false # 执行过渡 if $game_switches[$旋转切换]==true Graphics.transition(0) loop do @blur_window.update # 刷新游戏画面 Graphics.update if $game_switches[$旋转切换] == false break end end elsif $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # 显示信息窗口中的情况下 if $game_temp.message_window_showing return end # 遇敌计数为 0 且、且遇敌列表不为空的情况下 if $game_player.encounter_count == 0 and $game_map.encounter_list != [] # 不是在事件执行中或者禁止遇敌中 unless $game_system.map_interpreter.running? or $game_system.encounter_disabled # 确定队伍 n = rand($game_map.encounter_list.size) troop_id = $game_map.encounter_list[n] # 队伍有效的话 if $data_troops[troop_id] != nil # 设置调用战斗标志 $game_temp.battle_calling = true $game_temp.battle_troop_id = troop_id $game_temp.battle_can_escape = true $game_temp.battle_can_lose = false $game_temp.battle_proc = nil end end end # 按下 B 键的情况下 if Input.trigger?(Input::B) # 不是在事件执行中或菜单禁止中 unless $game_system.map_interpreter.running? or $game_system.menu_disabled # 设置菜单调用标志以及 SE 演奏 $game_temp.menu_calling = true $game_temp.menu_beep = true end end # 调试模式为 ON 并且按下 F9 键的情况下 if $DEBUG and Input.press?(Input::F9) # 设置调用调试标志 $game_temp.debug_calling = true end # 不在主角移动中的情况下 unless $game_player.moving? # 执行各种画面的调用 if $game_temp.battle_calling call_battle elsif $game_temp.shop_calling call_shop elsif $game_temp.name_calling call_name elsif $game_temp.menu_calling call_menu elsif $game_temp.save_calling call_save elsif $game_temp.debug_calling call_debug end end end #-------------------------------------------------------------------------- # ● 场所移动的变化 #-------------------------------------------------------------------------- alias plan_map_window_transfer_player transfer_player def transfer_player # 获取移动前的场景 @blur_window.get_bitmap plan_map_window_transfer_player @blur_window.refresh_map endend#==============================================================================# Blur_Effect#==============================================================================class Blur_Effect def initialize @blur_map=Picture_Map.new @map_cw=@blur_map.width @map_ch=@blur_map.height @blurSprite=Sprite.new @blurSprite.bitmap=Bitmap.new(@map_cw,@map_ch) @blurSprite.z=9999 @blurSprite.ox=320 @blurSprite.oy=240 @blurSprite.x=320 @blurSprite.y=240 end def get_bitmap @blur_map.update @blurSprite.bitmap.blt(0,0,@blur_map,Rect.new(0,0,@map_cw,@map_ch)) end def update if $game_switches[$旋转切换] == true @blurSprite.visible=true @blurSprite.angle+=20 @blurSprite.zoom_x-=0.02 @blurSprite.zoom_y-=0.02 if @blurSprite.zoom_y= 384 @bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) @cw = 32 @ch = 32 else @bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) end end # 图形是角色的情况下 if @tile_id == 0 # 设置传送目标的矩形 sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch self.blt(0,0,@bitmap,Rect.new(sx,sy,@cw,@ch)) end #计算title if self.visible if @x != self.x or @y != self.y @x=self.x @y=self.y @stopTitles.clear #@moveTitles.clear tile_x=self.real_width/32 if tile_x%2==0 tile_x+=1 end tile_y=(self.real_height/32.0).ceil for j in 0...tile_y maskId=[self.x,self.y-j,j] @stopTitles.push(maskId) for i in 1..(tile_x-1)/2 maskId=[self.x-i,self.y-j,j] @stopTitles.push(maskId) maskId=[self.x+i,self.y-j,j] @stopTitles.push(maskId) end end @[email protected] case @character.direction when 2 #向下 maskId=[self.x,self.y-tile_y,tile_y] @moveTitles.push(maskId) for i in 1..(tile_x-1)/2 maskId=[self.x-i,self.y-tile_y,tile_y] @moveTitles.push(maskId) maskId=[self.x+i,self.y-tile_y,tile_y] @moveTitles.push(maskId) end when 4 #向左 for j in 0...tile_y maskId=[self.x+(tile_x-1)/2+1,self.y-j,j] @moveTitles.push(maskId) end when 6 #向右 for j in 0...tile_y maskId=[self.x-(tile_x-1)/2-1,self.y-j,j] @moveTitles.push(maskId) end when 8 #向上 for k in @moveTitles k[2]+=1 end maskId=[self.x,self.y+1,0] @moveTitles.push(maskId) for i in 1..(tile_x-1)/2 maskId=[self.x-i,self.y+1,0] @moveTitles.push(maskId) maskId=[self.x+i,self.y+1,0] @moveTitles.push(maskId) end end end end end def x return @character.x end def y return @character.y end def screen_x return @character.screen_x end def screen_y return @character.screen_y end def screen_z return @character.screen_z(@ch) end def real_width return @cw end def real_height return @ch end def visible return [email protected] end def opacity return @character.opacity end def maskTitles if @character.moving? return @moveTitles else return @stopTitles end endend#==============================================================================# Picture_Map#==============================================================================class Picture_Map < Bitmap def initialize super(640,480) @map_cw = $game_map.width * 32 @map_ch = $game_map.height * 32 @tileset = RPG::Cache.tileset($game_map.tileset_name) @autotiles = [] for i in 0..6 autotile_name = $game_map.autotile_names[i] @autotiles[i] = RPG::Cache.autotile(autotile_name) end @map_data = $game_map.data @priorities = $game_map.priorities @character_sprites = [] for i in $game_map.events.keys.sort sprite = Picture_Character.new($game_map.events[i]) @character_sprites.push(sprite) end @character_sprites.push(Picture_Character.new($game_player)) @all_map = Bitmap.new (@map_cw,@map_ch) make_map end def update self.clear self.blt(0,0,@all_map,Rect.new(map_x,map_y,width,height)) # 刷新角色活动块 @character_sprites.sort!{|a,b|a.screen_zb.screen_z} for sprite in @character_sprites if sprite.visible sprite.update px=sprite.screen_x-sprite.real_width/2 py=sprite.screen_y-sprite.real_height self.blt(px,py,sprite,Rect.new(0,0,sprite.real_width,sprite.real_height),sprite.opacity) for mask_id in sprite.maskTitles next unless $game_map.valid?(mask_id[0], mask_id[1]) for i in [2, 1, 0] tile = @map_data[mask_id[0], mask_id[1], i] next if tile == 0 #透明的 if $game_map.priorities[tile] > mask_id[2] if tile < 384 if tile >= 48 tile -= 48 src_rect = Rect.new(32, 2 * 32, 32, 32) self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @autotiles[tile / 48], src_rect) end else tile -= 384 src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32) self.blt(mask_id[0] * 32 - map_x, mask_id[1] * 32 - map_y, @tileset, src_rect) end break end end end end end end def dispose super # 释放元件地图 @tileset.dispose for i in 0..6 @autotiles[i].dispose end # 释放角色活动块 for sprite in @character_sprites sprite.dispose end @all_map.dispose end def make_map for y in 0...$game_map.height for x in 0...$game_map.width for z in 0...3 tile = @map_data[x, y, z] next if tile == nil if tile < 384 if tile >= 48 tile -= 48 src_rect = Rect.new(32, 2 * 32, 32, 32) @all_map.blt(x * 32, y * 32, @autotiles[tile / 48], src_rect) end else tile -= 384 src_rect = Rect.new(tile % 8 * 32, tile / 8 * 32, 32, 32) @all_map.blt(x * 32, y * 32, @tileset, src_rect) end end end end end def map_width return @map_cw end def map_height return @map_ch end def map_x return $game_map.display_x / 4 end def map_y return $game_map.display_y / 4 endend复制代码
复制代码附件:
用法:
# 准备渐变
# 开关[旋转切换]=ON
# 场所移动
# 执行渐变
本帖来自P1论坛作者shoed,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=207418 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。