这是我的工程,脚本原汁原味没变过。 |
事件标题想设置几个就设置几个 |
本帖最后由 zxcgood2009 于 2012-9-15 19:05 编辑 #============================================================================== # 本脚本来自www.66RPG.com,使用和转载请保留此信息 # 作者:chaochao+66rpg的66 #============================================================================== #============================================================================== #■ 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 = 5 # X方向每回合减少象素 WEATHER_Y = 5 # 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_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 # 生成标题图形 @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) @ox = 0 @oy = 0 color1 = Color.new(255,255,255, 255) color2 = Color.new(255, 255, 255, 128) @rain_bitmap = Bitmap.new(7, 56) for i in 0..8 @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1) end @storm_bitmap = Bitmap.new(34, 64) for i in 0..31 @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2) @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1) @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2) end @snow_bitmap = Bitmap.new(6, 6) @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 # 生成标题图形 @sprite = [Sprite.new] #-------------------------------------------------------------------------- for i in 0..8 #-------------------------------------------------------------------------- @sprite = Sprite.new @sprite.opacity = 0 end @sprite[0].bitmap = RPG::Cache.title($data_system.title_name) @sprite[0].opacity = 0 #开始游戏的图片 @sprite[1].bitmap = Bitmap.new("Graphics/Pictures/t1.png") @sprite[2].bitmap = Bitmap.new("Graphics/Pictures/t2.png") #继续游戏的图片 @sprite[3].bitmap = Bitmap.new("Graphics/Pictures/t3.png") @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/t4.png") #结束游戏的图片 @sprite[5].bitmap = Bitmap.new("Graphics/Pictures/t5.png") @sprite[6].bitmap = Bitmap.new("Graphics/Pictures/t6.png") #-------------------------------------------------------------------------- #第四项的图片 @sprite[7].bitmap = Bitmap.new("Graphics/Pictures/t7.png") @sprite[8].bitmap = Bitmap.new("Graphics/Pictures/t8.png") #-------------------------------------------------------------------------- #图片位置 #-------------------------------------------------------------------------- for i in 1..8 #-------------------------------------------------------------------------- x=40 y=(i+1)/2*45+200 @sprite.x =x @sprite.y =y end @continue_enabled = false for i in 0..3 if FileTest.exist?("Save/Save#{i+1}.rxdata") @continue_enabled = true end end if @continue_enabled @command_index = 1 else @command_index = 0 @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/t3.png") end $game_system.bgm_play($data_system.title_bgm) Audio.me_stop Audio.bgs_stop Graphics.transition loop do Graphics.update #淡出背景圖形 if @sprite[0].opacity <= 255 @sprite[0].opacity += 15 end Input.update update if $scene != self break end end Graphics.freeze # 釋放圖形 for i in 0..8 @sprite.bitmap.dispose @sprite.dispose end for sprite in @sprites sprite.dispose end @rain_bitmap.dispose @storm_bitmap.dispose @snow_bitmap.dispose end #-------------------------------------------------------------------------- # ● 刷新天气 #-------------------------------------------------------------------------- def weather_update return if WEATHER == 0 for i in 1..MAXNUMBER sprite = @sprites if sprite == nil break end if WEATHER == 1 sprite.x -= 2 sprite.y += 16 sprite.opacity -= 8 end if WEATHER == 2 sprite.x -= 8 sprite.y += 16 sprite.opacity -= 12 end if WEATHER == 3 sprite.x -= 2 sprite.y += 8 sprite.opacity -= 8 end if WEATHER == 4 sprite.x -= WEATHER_X sprite.y += WEATHER_Y sprite.opacity -= WEATHER_OPACITY end x = sprite.x - @ox y = sprite.y - @oy if sprite.opacity < 32 or x < -100 or x > 750 or y < -1000 or y > 500 sprite.x = rand(RAND_X) + WIDTH + @ox sprite.y = rand(RAND_Y) + HEIGHT + @oy sprite.bitmap = Bitmap.new(WEATHER_FILE) sprite.opacity = START_OPACITY end end end def update chaochaocommandchaochao if Input.trigger?(Input::C) case @command_index when 0 command_new_game when 1 command_continue when 2 command_shutdown when 3 $scene = Scene_End.new end end weather_update end def chaochaocommandchaochao for i in 1..8 @sprite.x -=20 if @sprite.x >230 end if Input.trigger?(Input::UP) @command_index -= 1 if @command_index < 0 @command_index = 3 end $game_system.se_play($data_system.cursor_se) end if Input.trigger?(Input::DOWN) @command_index += 1 if @command_index > 3 @command_index = 0 end $game_system.se_play($data_system.cursor_se) end case @command_index when 0 if @sprite[1].opacity >= 0 @sprite[1].opacity -= 30 end # @sprite[1].zoom_x -= 0.05 if @sprite[1].zoom_x >=0 # @sprite[2].zoom_x += 0.05 if @sprite[2].zoom_x <=0.95 # @sprite[4].zoom_x -= 0.05 if @sprite[4].zoom_x >=0 # @sprite[3].zoom_x += 0.05 if @sprite[3].zoom_x <=0.95 # @sprite[6].zoom_x -= 0.05 if @sprite[6].zoom_x >=0 # @sprite[5].zoom_x += 0.05 if @sprite[5].zoom_x <=0.95 @sprite[1].zoom_y -= 0.05 if @sprite[1].zoom_y >=0 @sprite[2].zoom_y += 0.05 if @sprite[2].zoom_y <=0.95 @sprite[3].zoom_y += 0.05 if @sprite[3].zoom_y <=0.95 @sprite[4].zoom_y -= 0.05 if @sprite[4].zoom_y >=0 @sprite[5].zoom_y += 0.05 if @sprite[5].zoom_y <=0.95 @sprite[6].zoom_y -= 0.05 if @sprite[6].zoom_y >=0 @sprite[7].zoom_y += 0.05 if @sprite[7].zoom_y <=0.95 @sprite[8].zoom_y -= 0.05 if @sprite[8].zoom_y >=0 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 if @sprite[7].opacity <= 210 @sprite[7].opacity += 30 end if @sprite[8].opacity >= 0 @sprite[8].opacity -= 30 end when 1 # @sprite[2].zoom_x -= 0.05 if @sprite[2].zoom_x >=0 # @sprite[1].zoom_x += 0.05 if @sprite[1].zoom_x <=0.95 # @sprite[3].zoom_x -= 0.05 if @sprite[3].zoom_x >=0 # @sprite[4].zoom_x += 0.05 if @sprite[4].zoom_x <=0.95 # @sprite[6].zoom_x -= 0.05 if @sprite[6].zoom_x >=0 # @sprite[5].zoom_x += 0.05 if @sprite[5].zoom_x <=0.95 @sprite[1].zoom_y += 0.05 if @sprite[1].zoom_y <=0.95 @sprite[2].zoom_y -= 0.05 if @sprite[2].zoom_y >=0 @sprite[3].zoom_y -= 0.05 if @sprite[3].zoom_y >=0 @sprite[4].zoom_y += 0.05 if @sprite[4].zoom_y <=0.95 @sprite[5].zoom_y += 0.05 if @sprite[5].zoom_y <=0.95 @sprite[6].zoom_y -= 0.05 if @sprite[6].zoom_y >=0 @sprite[7].zoom_y += 0.05 if @sprite[7].zoom_y <=0.95 @sprite[8].zoom_y -= 0.05 if @sprite[8].zoom_y >=0 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 if @sprite[7].opacity <= 210 @sprite[7].opacity += 30 end if @sprite[8].opacity >= 0 @sprite[8].opacity -= 30 end when 2 # @sprite[2].zoom_x -= 0.05 if @sprite[2].zoom_x >=0 # @sprite[1].zoom_x += 0.05 if @sprite[1].zoom_x <=0.95 # @sprite[4].zoom_x -= 0.05 if @sprite[4].zoom_x >=0 # @sprite[3].zoom_x += 0.05 if @sprite[3].zoom_x <=0.95 # @sprite[5].zoom_x -= 0.05 if @sprite[5].zoom_x >=0 # @sprite[6].zoom_x += 0.05 if @sprite[6].zoom_x <=0.95 @sprite[1].zoom_y += 0.05 if @sprite[1].zoom_y <=0.95 @sprite[2].zoom_y -= 0.05 if @sprite[2].zoom_y >=0 @sprite[3].zoom_y += 0.05 if @sprite[3].zoom_y <=0.95 @sprite[4].zoom_y -= 0.05 if @sprite[4].zoom_y >=0 @sprite[5].zoom_y -= 0.05 if @sprite[5].zoom_y >=0 @sprite[6].zoom_y += 0.05 if @sprite[6].zoom_y <=0.95 @sprite[7].zoom_y += 0.05 if @sprite[7].zoom_y <=0.95 @sprite[8].zoom_y -= 0.05 if @sprite[8].zoom_y >=0 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 if @sprite[7].opacity <= 210 @sprite[7].opacity += 30 end if @sprite[8].opacity >= 0 @sprite[8].opacity -= 30 end when 3 @sprite[1].zoom_y += 0.05 if @sprite[1].zoom_y <=0.95 @sprite[2].zoom_y -= 0.05 if @sprite[2].zoom_y >=0 @sprite[3].zoom_y += 0.05 if @sprite[3].zoom_y <=0.95 @sprite[4].zoom_y -= 0.05 if @sprite[4].zoom_y >=0 @sprite[5].zoom_y -= 0.05 if @sprite[5].zoom_y >=0.95 @sprite[6].zoom_y += 0.05 if @sprite[6].zoom_y <=0 @sprite[7].zoom_y += 0.05 if @sprite[7].zoom_y <=0 @sprite[8].zoom_y -= 0.05 if @sprite[8].zoom_y >=0.95 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 <= 210 @sprite[5].opacity -= 30 end if @sprite[6].opacity >= 0 @sprite[6].opacity += 30 end if @sprite[7].opacity >= 0 @sprite[7].opacity -= 30 end if @sprite[8].opacity <= 240 @sprite[8].opacity += 30 end end end end 给你解决了,但是还有问题,第四项的 t8.png 显示不出来,找了很久,都没给解决,自己想办法吧。 |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-28 11:01
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.