赞 | 0 |
VIP | 313 |
好人卡 | 0 |
积分 | 1 |
经验 | 6681 |
最后登录 | 2024-1-20 |
在线时间 | 66 小时 |
Lv1.梦旅人 蚂蚁卡卡
- 梦石
- 0
- 星屑
- 116
- 在线时间
- 66 小时
- 注册时间
- 2007-12-16
- 帖子
- 3081
|
走马灯效果
- #==============================================================================
- #■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
- class Scene_Title
- WEATHER = 4 # 使用自定义效果(0:无,1:雨,2:暴风雨,3:雪,4:自定义)
- MAXNUMBER = 18 # 天气图片数量
-
- WEATHER_FILE = "Graphics/Pictures/Title_starlong.png"
- # 自定义图片路径,这个文件可以从黑暗圣剑DEMO获得,是流星雨
-
- BLEND_TYPE = 0 # 合成方式(0:普通,1:加法,2:减法)
- WEATHER_X = 0 # X方向每回合减少象素
- WEATHER_Y = 0 # Y方向每回合减少象素
- WEATHER_OPACITY = 2 #每回合减低透明度
- START_OPACITY = 200 #出现时的透明度
- RAND_X = 1200 # 随机X范围
- RAND_Y = 600 # 随机Y范围
- HEIGHT = -600 # 出现时候的屏幕Y
- WIDTH = 100 # 出现时候的屏幕X
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
-
- def main
-
- if $BTEST
- battle_test
- return
- end
- #########################################################
- $data_mapinfos = load_data("Data/MapInfos.rxdata")
- #########################################################
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- $game_system = Game_System.new
- @ox = 0
- @oy = 0
- color1 = Color.new(255,255,255, 255)
- color2 = Color.new(255, 255, 255, 128)
- @rain_bitmap = Bitmap.new(640, 480)
- for i in 0..6
- @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
- end
- @storm_bitmap = Bitmap.new(640, 480)
- for i in 0..31
- @storm_bitmap.fill_rect(100, i*2, 1, 2, color2)
- @storm_bitmap.fill_rect(200, i*2, 1, 2, color1)
- @storm_bitmap.fill_rect(300, i*2, 1, 2, color2)
- end
- @snow_bitmap = Bitmap.new(640, 480)
- @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
- @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
- @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
- @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
- @sprites = []
- for i in 1..40
- sprite = Sprite.new
- case WEATHER
- when 1
- sprite.bitmap = @rain_bitmap
- when 2
- sprite.bitmap = @storm_bitmap
- when 3
- sprite.bitmap = @snow_bitmap
- when 4
- sprite.bitmap = Bitmap.new(WEATHER_FILE)
- end
- sprite.z = 1000
- sprite.x = -1000
- sprite.y = -1000
- sprite.visible = (i <= MAXNUMBER)
- sprite.blend_type = BLEND_TYPE
- sprite.opacity = START_OPACITY
- @sprites.push(sprite)
- end
- #weather_update
- start
- perform_transition # 开始转换
- Input.update
- menu_back_pic_new
- # 生成标题图形
- @sprite = [Sprite.new]
- for i in 0..6
- @sprite[i] = Sprite.new
- @sprite[i].opacity = 0
- end
- @sprite[0].bitmap = RPG::Cache.title("000")
- @sprite[0].opacity = 0
- @sprite[0].z = 11
- @delay = 0
- @back_no = 0
- ############################################################
- #开始游戏的图片
- @sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start-1.png")
- @sprite[2].bitmap = Bitmap.new("Graphics/Pictures/2.png")
- #继续游戏的图片
- @sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue-1.png")
- @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/4.png")
- #结束游戏的图片
- @sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit-1.png")
- @sprite[6].bitmap = Bitmap.new("Graphics/Pictures/6.png")
- #图片位置
-
- for i in 1..6
- @sprite[i].z = 10
-
- case $menu_back_type
- when 0
- x=0
- y=0#(i+1)/2*35+180 + 79
- @sprite[i].x =x
- @sprite[i].y =y
- when 1
- x=0
- y=0#(i+1)/2*35+296 - 108
- @sprite[i].x =x
- @sprite[i].y =y
- when 2
- x=0
- y=0#(i+1)/2*35+296 - 108
- @sprite[i].x =x
- @sprite[i].y =y
- end
-
- end
- dx = 1
- dy = 1
- # @new_port = Viewport.new(0, 0, 640, 480)
- #@continue_port = Viewport.new(0, 0, 640, 480)
- #@end_port = Viewport.new(0, 0, 640, 480)
- #@continue_animation = RPG::Sprite.new(@continue_port)
- # @end_animation = RPG::Sprite.new(@end_port)
- #@new_animation = RPG::Sprite.new(@new_port)
- #@new_animation.x = @sprite[1].x + dx
- #@new_animation.y = @sprite[1].y + dy
- #@continue_animation.x = @sprite[3].x + dx
- #@continue_animation.y = @sprite[3].y + dy
- #@end_animation.x = @sprite[5].x + dx
- #@end_animation.y = @sprite[5].y + dy
- #@new_animation.z = @menupic.z + 100
- #@continue_animation.z = @menupic.z + 100
- #@end_animation.z = @menupic.z + 100
- @continue_enabled = false
- for i in 0..9
- if FileTest.exist?("Save/Save#{i}.rxdata")
- @continue_enabled = true
- end
- end
- if @continue_enabled
- @command_index = 1
- else
- @command_index = 0
- @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/4.png")
- end
- #对上一次的按钮焦点记录
- $bsylastcommand_index = @command_index
- $game_system.bgm_play($data_system.title_bgm)
- Audio.me_stop
- Audio.bgs_stop
- Graphics.transition
- loop do
- if $piantou == 1
- case $menu_back_type
- when 0
- menu_update_title_a
- when 1
- menu_update_title_c
-
- end
- end
-
- @image_sprite.y -= 2
- @zhedang.y -= 2
- # @bitmap.y -= 2# 渐渐移动
- # if @image_sprite.x > 500
- # @image_sprite.x = 0
- # end
- #end
- Graphics.update
-
- @image_sprite.update
- @zhedang.update
- # @bitmap.update
- #淡出背景圖形
- if @sprite[0].opacity <= 255
- @sprite[0].opacity += 15
- end
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- #mask_effect
- Graphics.transition
-
- # 釋放圖形
- for i in 0..6
- @sprite[i].bitmap.dispose
- @sprite[i].dispose
- end
- for sprite in @sprites
- sprite.dispose
- end
- @image_sprite.dispose
- @menupic.dispose
- @zhedang.dispose
- # @bitmap.dispose
- # @new_animation.dispose
- # @continue_animation.dispose
- # @end_animation.dispose
- @rain_bitmap.dispose
- @storm_bitmap.dispose
- @snow_bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新天气
- #--------------------------------------------------------------------------
-
- def menu_back_pic_new
- @menupic = Sprite.new
- @menupic.bitmap = Bitmap.new(640,480)
- @menupic.x = 0
- @menupic.y = 0
- @menupic.z = 8
- end
- def menu_update_title_a
- if @delay == 2
- if @back_no <= 1
- @menupic.bitmap = $menupicback[@back_no].bitmap
- @back_no = 1
- @delay = 0
- else
- @back_no = 0
- @menupic.bitmap = $menupicback[@back_no].bitmap
- @back_no += 1
- end
- else
- @delay += 1
- end
- end
-
- def menu_update_title_c
- if @delay == 2
- if @back_no <= 49
- @menupic.bitmap = $menupicback[@back_no].bitmap
- @back_no += 1
- @delay = 0
- else
- @back_no = 0
- @menupic.bitmap = $menupicback[@back_no].bitmap
- @back_no += 1
- end
- else
- @delay += 1
- end
- end
-
-
- #######################################################
- def fadein(sprite, duration = 40)
- sprite.opacity = 0
- for i in 0...duration
- sprite.opacity = 255 * i / duration
- Input.update
- # Graphics.update
- #因为这个也是用显示图片的做法
- #所以,在update图片模块显示时 会卡住= =| 不得已删掉这个渐变的效果
-
- # update_cmd
- # update_cloud
-
-
- break until sprite.opacity >= 255 #or show_fast?
- end
- sprite.opacity = 255
- end
- def perform_transition
- Graphics.transition(4)
- end
- #--------------------------------------------------------------------------
- # ○ 渐隐
- #--------------------------------------------------------------------------
- def fadeout(sprite, duration = 40, dispose = true)
- for i in 0...duration
- sprite.opacity = 255 - 255 * i / duration
-
- Input.update
- @zhedang.dispose
- @zhedang.bitmap.dispose
- # Graphics.update
- # update_cmd
- # update_cloud
- break until sprite.opacity <= 0# or show_fast?
- end
-
- sprite.opacity = 0
- return unless dispose
- sprite.bitmap.dispose
- sprite.dispose
- # @zhedang.dispose
- #@zhedang.bitmap.dispose
- @bitmap.dispose
- @bitmap.bitmap.dispose
- @image_sprite.dispose
- @image_sprite.bitmap.dispose
- end
-
- def start
- # 菜单项计数器
- @index = 0
- # 随机渐变图计数器
- @fade_count = 1
- # check_continue
- # 开始
- # section_start
- # 片段1
- #section_logo
- # 片段2
- #section_bg
- # 片段3
- #section_cmd
- # 片段4
- section_image
-
-
- # 片段5
- ##section_plane
- end
-
- # def rand_file(exclude = nil)
- # file = Dir.entries("Save")
- #file.delete(".");file.delete("..")
- ## 排除
- #file.delete(exclude) unless exclude == nil
- #return file[rand(file.size)]
- #end
- def section_image
- # @image_sprite = Sprite.new
- set_rand_bitmap(@image_sprite_bitmap, false)
- Graphics.freeze
- # mask_effect
- Graphics.transition
-
- end
-
- def mask_effect
- for i in 0..640#@image_sprite.bitmap.height
- for j in 0..480#@image_sprite.bitmap.width
- mask_pe = @image_sprite.bitmap.get_pixel(j, i)
- bitmap_pe = @bitmap.bitmap.get_pixel(j, i)
- new_alpha = mask_pe.red*0.3 + mask_pe.green*0.59 + mask_pe.blue*0.11
- # color = Color.new(gray,gray,gray)
- color = Color.new(bitmap_pe.red, bitmap_pe.green, bitmap_pe.blue, 255-new_alpha)
-
- @bitmap.bitmap.set_pixel(j, i, color)
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # ○ 设定随机图
- #--------------------------------------------------------------------------
- def set_rand_bitmap(exclude = nil, fadout = true)
-
- # @image = rand_file(exclude)
- # fadeout(@bitmap,20,false) if fadout
- fadeout(@image_sprite, 20, false) if fadout
-
- @zhedang = Sprite.new
- @zhedang.bitmap = Bitmap.new("Graphics/system/menu/" + "【随机】遮挡.png")
- @zhedang.x = 6
- @zhedang.y = 470
- @zhedang.z = 10
- @image = "save" + "#{rand(14)}" # save0到13
-
-
- if FileTest.exist?("Save/" + @image + ".jpg")
- # @image_sprite.bitmap = Cache.actor(@image)
- # @image_sprite = Sprite.new
- @image_sprite = Sprite.new
-
-
- # @image_sprite1 = Sprite.new
- @image_sprite.bitmap = Bitmap.new("Save/" + @image + ".jpg" )
-
- @image_sprite.zoom_x = 0.25
- @image_sprite.zoom_y = 0.25
-
-
- else
- @image_sprite = Sprite.new
- #@image_sprite1 = Sprite.new
- @image_sprite.bitmap = Bitmap.new("Graphics/system/menu/" + "【随机】#{rand(3)}.png")
- #@image_sprite1.bitmap = Bitmap.new("Graphics/system/menu/" + "【随机】遮挡.png")
-
- @image_sprite.zoom_x = 1
- @image_sprite.zoom_y = 1
-
-
- end
-
- @image_sprite.x = 24
- @image_sprite.y = 480
-
-
- #self.contents.draw_circle(100, 100,100, normal_color)
- #if @image_sprite.bitmap = nil
- # @image +=1
- #end
- # src_rect = Rect.new(0, 0, 53, 66)
- # self.contents.blt(x - 64, y + 10, @image_sprite.bitmap, src_rect)
- #416-8 - @image_sprite.bitmap.height
- # @image_sprite.width = 200
-
- #@image_sprite.height = 80
- @image_sprite.z = 9
-
- # @bitmap = Sprite.new
- # @bitmap.bitmap = RPG::Cache.picture("03.png")
- # @bitmap.zoom_x = 0.25
- # @bitmap.zoom_y = 0.25
-
- # @bitmap.x = 24
- # @bitmap.y = 480
- # @bitmap.z = 10
- #fadein(@image_sprite)
- # fadein(@bitmap)
- end
- def update_image
-
- unless @image == nil
-
- if @fade_count <= 1
- @fade_count = 280
- set_rand_bitmap(@image)
-
- else
- @fade_count -= 1
- end
- end
- end
-
- ####################################################
-
- def menu_update_b
- if @delay == 1
- $rectpic.y = 364 * ( $menupicn - ($i - 1 ) * 50 )
- @menupic.bitmap.blt(0, 0, $menupicback[$i].bitmap, $rectpic)
- if $menupicn == 50 or $menupicn == 100 or $menupicn == 150 or $menupicn == 200 or $menupicn == 250 or $menupicn == 300 or $menupicn == 350 or $menupicn == 400
- $i = ( $menupicn /50 ) + 1
- end
- if $menupicn == 149
- $menupicn = 0
- $i = 1
- else
- $menupicn += 1
- end
- @delay = 0
- elsif @delay == 0
- @delay = 1
- end
- end
- def update
- # @command_window.update
- update_image
- @image_sprite.update
- @zhedang.update
- # @new_animation.update
- # @continue_animation.update
- # @end_animation.update
- # mouse_x, mouse_y = Mouse.get_mouse_pos
- chaochaocommandchaochao
- # bsymousecommandmouse
- if Input.trigger?(Input::C)
- case @command_index
- when 0
- command_new_game
- when 1
- command_continue
- when 2
- command_shutdown
- end
- end
- end
-
- def chaochaocommandchaochao
- if Input.trigger?(Input::LEFT)
- @command_index -= 1
- if @command_index < 0
- @command_index = 2
- end
- $game_system.se_play($data_system.cursor_se)
- end
- if Input.trigger?(Input::RIGHT)
- @command_index += 1
- if @command_index > 2
- @command_index = 0
- end
- $game_system.se_play($data_system.cursor_se)
- end
- case @command_index
- when 0
- #################################################################
- # @new_animation.loop_animation($data_animations[578])
- # @continue_animation.loop_animation(nil)
- # @end_animation.loop_animation(nil)
- #################################################################
- if @sprite[1].opacity >= 0
- @sprite[1].opacity -= 30
- end
- if @sprite[2].opacity <= 240
- @sprite[2].opacity += 30
- end
- if @sprite[3].opacity <= 210
- @sprite[3].opacity += 30
- end
- if @sprite[4].opacity >= 0
- @sprite[4].opacity -= 30
- end
- if @sprite[5].opacity <= 210
- @sprite[5].opacity += 30
- end
- if @sprite[6].opacity >= 0
- @sprite[6].opacity -= 30
- end
- when 1
- #################################################################
- # @new_animation.loop_animation(nil)
- #@continue_animation.loop_animation($data_animations[579])
- #@end_animation.loop_animation(nil)
- #################################################################
- if @sprite[1].opacity <= 210
- @sprite[1].opacity += 30
- end
- if @sprite[2].opacity >= 0
- @sprite[2].opacity -= 30
- end
- if @sprite[3].opacity >= 0
- @sprite[3].opacity -= 30
- end
- if @sprite[4].opacity <= 240
- @sprite[4].opacity += 30
- end
- if @sprite[5].opacity <= 210
- @sprite[5].opacity += 30
- end
- if @sprite[6].opacity >= 0
- @sprite[6].opacity -= 30
- end
- when 2
- #################################################################
- # @new_animation.loop_animation(nil)
- # @continue_animation.loop_animation(nil)
- # @end_animation.loop_animation($data_animations[580])
- #################################################################
- if @sprite[1].opacity <= 210
- @sprite[1].opacity += 30
- end
- if @sprite[2].opacity >= 0
- @sprite[2].opacity -= 30
- end
- if @sprite[3].opacity <= 210
- @sprite[3].opacity += 30
- end
- if @sprite[4].opacity >= 0
- @sprite[4].opacity -= 30
- end
- if @sprite[5].opacity >= 0
- @sprite[5].opacity -= 30
- end
- if @sprite[6].opacity <= 240
- @sprite[6].opacity += 30
- end
- end
- end
- end
复制代码
脚本来自《隋唐乱》解密版
其实也就是走马灯 |
|