Project1
标题:
rpg中 这脚本怎么链接开始游戏?
[打印本页]
作者:
炽牙
时间:
2010-2-21 09:07
标题:
rpg中 这脚本怎么链接开始游戏?
begin
patch = Win32API.new("1024patch.dll", "start", "p", "i")
rescue RuntimeError
raise ""
end
if (ret = patch.call("Game")) < 0
raise ""
end
module RPG
module Cache
def self.logo(filename)
self.load_bitmap("Graphics/Logo/", filename)
end
end
end
class Sprite < ::Sprite
attr_accessor :透明度
def initialize(viewport = nil)
super(viewport)
@透明度 = :无
end
end
class NS_Ani < RPG::Sprite
def initialize
@v = Viewport.new(0,0,1024,768)
@v.z = 10
super(@v)
self.z = 15
self.bitmap = Bitmap.new(16,16)
self.ox,self.oy = 8,8
update
end
def ani(x,y,id)
self.x,self.y = x,y
animation = $data_animations[id]
animation(animation, false)
id = 0
end
def dispose
super
@v.dispose
end
def update
super
end
end
class Scene_Logo
def main
$data_animations = load_data("Data/Animations.rxdata")
@anis = []
10.times{@anis << NS_Ani.new}
@ani_con = []
10.times{@ani_con << false}
# 计数
@count = 0
# 步骤
@phase = 0
# 移动标记
@move = true
# 主画面开始标记
@logo_start = false
# 移动步骤
@update_01_phase = 0
# 等待帧
@wait = 0
#
@frames = [200,100]
# number
@number = 0
# menu_step
@menu_step = 0
# aspeed
@aspeed = 0
# 装载
load_bitmap
set_sprite
Graphics.transition(80)
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
end
def load_bitmap
@bitmap_black = RPG::Cache.logo("black.jpg")
@bitmap_t1 = RPG::Cache.logo("字.png")
@bitmap_bg_land = RPG::Cache.logo("bg_land.jpg")
@bitmap_bg_sky = RPG::Cache.logo("bg_sky.png")
@bitmap_bg_ff = RPG::Cache.logo("bg_ff.png")
@people1 = RPG::Cache.logo("1.png")
@people1max = RPG::Cache.logo("2.png")
@people2 = RPG::Cache.logo("未标题-1.png")
@people2max = RPG::Cache.logo("未标题-2.png")
@people3 = RPG::Cache.logo("未标题-3.png")
@people3max = RPG::Cache.logo("未标题-4.png")
@peoplemax = RPG::Cache.logo("c2.png")
@evl = RPG::Cache.logo("c.png")
@white = RPG::Cache.logo("white.png")
@bitmap_t2 = RPG::Cache.logo("logo.png")
@bitmap_yun1 = RPG::Cache.logo("yun1.png")
@bitmap_yun2 = RPG::Cache.logo("yun2.png")
@bitmap_yun2 = RPG::Cache.logo("yun3.png")
@bitmap_light1 = RPG::Cache.logo("line1.png")
@bitmap_light2 = RPG::Cache.logo("line2.png")
@bitmap_light3 = RPG::Cache.logo("line3.png")
end
def set_sprite
@s1 = Sprite.new
@s1.bitmap = @bitmap_black
@s1.z = 5
@s2 = Sprite.new
@s2.bitmap = @bitmap_black.clone
@s2.z = 5
@s2.y = 384
@s3 = Sprite.new
@s3.bitmap = @bitmap_t1
@s3.x,@s3.y,@s3.z = 400,768/
[email protected]
/2+7,6
@s_b1 = Sprite.new
@s_b1.bitmap = @bitmap_bg_land
@s_b1.x,@s_b1.y,@s_b1.z = 0,768-@s_b1.bitmap.height,0
end
def update
update_count
update_move if @move
update_move_bg if @move_bg != nil
@anis.each{|n|
n.update if n.effect?
}
case @phase
when 0
update_01
when 1
update_02
when 2
update_03
when 3
update_04
when 4
update_05
when 5
update_06
when 6
update_07
when 7
update_08
when 8
update_09
when 9
update_10
when 10
update_11
when 11
update_12
when 12
update_13
end
end
def update_move
if @logo_start == true
@s_b1.x -= 1 if Graphics.frame_count % 2 == 0
else
@s_b1.x -= 1
end
@s_b1.x = 0 if @s_b1.x == -@s_b1.bitmap.width + 1024
end
def update_move_bg
@move_bg.x -= 1 if Graphics.frame_count % 5 == 0
if @move_bg.x == -(1341)
@move_bg.x = 0
end
end
def update_count
if Graphics.frame_count >= 400
Graphics.frame_reset
Graphics.frame_count = 0
end
@count += 1
@wait -= 1 if @wait > 0
end
def update_01
case @update_01_phase
when 0
@s1.y -= 1
@s2.y += 1
when 1
when 2
@s1.y -= 3
@s2.y += 3
end
if @s1.y == -70
@update_01_phase = 1
@phase = 1
end
end
def update_02
淡出(@s3) if @wait == 0
end
def update_03
淡入(@s3) if @wait == 0
end
def update_04
淡出(@s3) if @wait == 0
if @wait> 0
@peple_bg.x -= 1
@peple_bg.opacity -= 2.5 if @wait < 80
end
end
def update_05
淡入(@s3) if @wait == 0
end
def update_06
淡出(@s3) if @wait == 0
if @wait > 0
@peple_bg.x += 1
@peple_bg.opacity -= 2.5 if @wait < 80
end
end
def update_07
淡入(@s3) if @wait == 0
end
def update_08
淡出(@s3) if @wait == 0
if @wait> 0
@peple_bg.x -= 1
@peple_bg.opacity -= 2.5 if @wait < 80
end
end
def update_09
# 交替图片
if @s3.x <= -1800
@s3.bitmap = RPG::Cache.logo("ani01/mc1.png")
@number = 1
@s3.x = -350
@phase += 1
@wait = 100
end
@s3.x -= 10
if @wait < 100
@peple_bg.x += 10
end
end
def update_10
if @number < 14
@number += 1 if Graphics.frame_count % 2 == 0
@s3.bitmap = RPG::Cache.logo("ani01/mc"
[email protected]
_s+".png")
#if @number == 13
#Audio.se_play("Audio/SE/se01.WAV")
#end
end
if @s1.y <= -400
@s3.bitmap.clear
@s3.bitmap = @white
@s3.x,@s3.y = -100,0
@s3.opacity = 0
@透明度 = :上升
# 建立菜单
@menu_a = Sprite.new
@menu_a.bitmap = RPG::Cache.logo("menu_a.png")
@menu_a.x,@menu_a.y,@menu_a.z = 1024,300,7
@menu_a.opacity = 0
@menu_b = Sprite.new
@menu_b.bitmap = RPG::Cache.logo("menu_b.png")
@menu_b.x,@menu_b.y,@menu_b.z = 1024+100,380,7
@menu_b.opacity = 0
@menu_c = Sprite.new
@menu_c.bitmap = RPG::Cache.logo("menu_c.png")
@menu_c.x,@menu_c.y,@menu_c.z = 1024+200,460,7
@menu_c.opacity = 0
@menu_d = Sprite.new
@menu_d.bitmap = RPG::Cache.logo("menu_d.png")
@menu_d.x,@menu_d.y,@menu_d.z = 1024+300,540,7
@menu_d.opacity = 0
@phase += 1
end
case @wait
when 81..100
@s3.x += @number + 10
when 60
@s3.x += @number + 20
@s3.bitmap = RPG::Cache.logo("ani01/mc15.png")
@s_b2 = Sprite.new
@s_b2.bitmap = @bitmap_bg_sky
@s_b2.x,@s_b2.y,@s_b2.z = 0,0,1
@s_b3 = Sprite.new
@s_b3.bitmap = @bitmap_bg_ff
@s_b3.x,@s_b3.y,@s_b3.z = 0,150,2
# 播放拉开声效
# Audio.se_play("Audio/SE/se08.WAV")
when 61..80
else
@s3.x += @number + 30
@s1.y -= 6
@s2.y += 6
end
end
def update_11
if @透明度 == :上升
@s3.opacity += 5
end
if @透明度 == :下降
if @wait == 0
@s3.opacity -= 5
end
if @s3.opacity == 0
Audio.se_play("Audio/SE/se08.WAV")
@s3.bitmap = @bitmap_t2
@s3.x,@s3.y = 280,50
@s3.opacity = 0
@phase += 1
end
end
if @s3.opacity == 255 and @透明度 == :上升
@wait = 30
@透明度 = :下降
@logo_start = true
# 停止移動
@move = false
# 移动背景
@move_bg = Sprite.new
@move_bg.bitmap = RPG::Cache.logo("bg_move.png")
@move_bg.z = 5
end
end
def update_12
@s3.opacity += 5 if @s3.opacity < 255
if @s3.opacity == 255
@phase += 1
@count = 0
@l1 = Sprite.new
@l1.bitmap = @bitmap_light1
@l2 = Sprite.new
@l2.bitmap = @bitmap_light2
@l3 = Sprite.new
@l3.bitmap = @bitmap_light3
@l1.z,@l2.z,@l3.z = 20,20,20
@l1.opacity,@l2.opacity,@l3.opacity = 0,0,0
@yun1 = Sprite.new
@yun1.bitmap = @bitmap_yun1
@yun2 = Sprite.new
@yun2.bitmap = @bitmap_yun2
@yun3 = Sprite.new
@yun3.bitmap = @bitmap_yun3
@yun1.z,@yun2.z,@yun3.z = 19,19,19
@yun1.x,@yun1.y = 1024,0
@yun2.x,@yun2.y = 1700,0
@yun3.x,@yun3.y = 2200,0
#Audio.bgm_play("Audio/BGM/music.mp3",100)
@menu_step = 1
end
end
def update_13
update_light
update_yun
update_menu
case @count
when 1
#Audio.se_play("Audio/SE/se08.WAV")
@anis[7].ani(200,400,990)
when 30
@anis[8].ani(200,600,988)
#when 120
#$@anis[9].ani(200,400,989)
end
if !@anis[7].effect? and @ani_con[7] == false
@anis[7].ani(430,680,999)
@ani_con[7] = true
end
if !@anis[8].effect? and @ani_con[8] == false and @count >= 30
@anis[8].ani(770,600,987)
@ani_con[8] = true
end
=begin
if !@anis[9].effect? and @ani_con[9] == false and @count >= 120
@anis[9].ani(820,240,989)
@ani_con[9] = true
end
=end
end
def update_light
case @count
when 20
@l1.透明度 = :上升
@l1.x = -200+rand(300)
when 125
@l2.透明度 = :上升
@l2.x = 100+rand(300)
when 250
@l3.透明度 = :上升
@l3.x = 400+rand(300)
end
if @l1.透明度 == :上升
@l1.opacity += 2
#@l1.x += 0.1
end
if @l2.透明度 == :上升
@l2.opacity += 2
#@l2.x += 0.1
end
if @l3.透明度 == :上升
@l3.opacity += 2
#@l3.x += 0.1
end
if @l1.透明度 == :下降
@l1.opacity -= 2
#@l1.x += 0.1
end
if @l2.透明度 == :下降
@l2.opacity -= 2
#@l2.x += 0.1
end
if @l3.透明度 == :下降
@l3.opacity -= 2
#@l3.x += 0.1
end
if @l1.opacity == 255
@l1.透明度 = :下降
end
if @l2.opacity == 255
@l2.透明度 = :下降
end
if @l3.opacity == 255
@l3.透明度 = :下降
end
if @l1.opacity == 0 and @count > 250
@l1.透明度 = :上升
@l1.x = -200+rand(300)
end
if @l2.opacity == 0 and @count > 250
@l2.透明度 = :上升
@l2.x = 100+rand(300)
end
if @l3.opacity == 0 and @count > 250
@l3.透明度 = :上升
@l3.x = 400+rand(300)
end
end
def update_yun
if Graphics.frame_count % 3 == 0
@yun1.x -= 1
@yun2.x -= 1
@yun3.x -= 1
end
@yun1.x = 1024 if @yun1.x <= -700
@yun2.x = 1700 if @yun1.x <= -800
@yun3.x = 2200 if @yun1.x <= -600
end
def 淡出(obj)
if obj.opacity == 0
case @phase
when 1
@wait = 120
@s3.bitmap = @people1
@s3.x,@s3.y = 80,200
when 3
@wait = 60
@s3.bitmap = @people2
@s3.x,@s3.y = 580,200
when 5
@wait = 60
@s3.bitmap = @people3
@s3.x,@s3.y = 80,200
when 7
# 左右交替图片
@wait = 200
@s3.bitmap = @peoplemax
@s3.x,@s3.y = 1024,200
@s3.opacity = 255
@peple_bg.bitmap = @evl
@peple_bg.x,@peple_bg.y = -800,339
@peple_bg.opacity = 255
#Audio.se_play("Audio/SE/se05.wav")
end
@phase += 1
else
obj.opacity -= 5 if obj.opacity > 0
end
end
def update_menu
if @menu_step != 0
@aspeed += 1 if @aspeed <= 30
end
case @menu_step
when 0
when 1
if @menu_a.opacity != 255
@menu_a.opacity += 5
end
if @menu_a.x <= 730 and @menu_a.x > 700
Audio.se_play("Audio/SE/se03.WAV")
end
if @menu_a.x <= 700
@menu_a.x = 700
if @menu_a.opacity != 255
@menu_a.opacity += 2
else
@menu_step += 1
end
else
@menu_a.x -= @aspeed
end
when 2
if @menu_b.opacity != 255
@menu_b.opacity += 5
end
if @menu_b.x <= 730 and @menu_b.x > 700
Audio.se_play("Audio/SE/se03.WAV")
end
if @menu_b.x <= 700
@menu_b.x = 700
@menu_step += 1
else
@menu_b.x -= @aspeed
end
when 3
if @menu_c.opacity != 255
@menu_c.opacity += 5
end
if @menu_c.x <= 730 and @menu_c.x > 700
Audio.se_play("Audio/SE/se03.WAV")
end
if @menu_c.x <= 700
@menu_c.x = 700
@menu_step += 1
else
@menu_c.x -= @aspeed
end
when 4
if @menu_d.opacity != 255
@menu_d.opacity += 5
end
if @menu_d.x <= 730 and @menu_d.x > 700
Audio.se_play("Audio/SE/se03.WAV")
end
if @menu_d.x <= 700
@menu_d.x = 700
@menu_step += 1
Graphics.frame_reset
Graphics.frame_count = 0
@wait = 60
@random = [60+rand(40),100+rand(40),140+rand(40),180+rand(40),220+rand(40),260+rand(40)]
@command_index = 0
else
@menu_d.x -= @aspeed
end
when 5
Audio.bgm_play("Audio/BGM/music.mp3",100) if @wait == 1
update_ani
update_command
case @command_index
when 0
@menu_a.opacity < 255 ? @menu_a.opacity += 5 : @menu_a.opacity = 255
@menu_b.opacity > 100 ? @menu_b.opacity -= 5 : @menu_b.opacity = 100
@menu_c.opacity > 100 ? @menu_c.opacity -= 5 : @menu_c.opacity = 100
@menu_d.opacity > 100 ? @menu_d.opacity -= 5 : @menu_d.opacity = 100
@menu_a.x > 650 ? @menu_a.x -= 4 : @menu_a.x = 650
@menu_b.x < 700 ? @menu_b.x += 4 : @menu_b.x = 700
@menu_c.x < 700 ? @menu_c.x += 4 : @menu_c.x = 700
@menu_d.x < 700 ? @menu_d.x += 4 : @menu_d.x = 700
when 1
@menu_b.opacity < 255 ? @menu_b.opacity += 5 : @menu_b.opacity = 255
@menu_a.opacity > 100 ? @menu_a.opacity -= 5 : @menu_a.opacity = 100
@menu_c.opacity > 100 ? @menu_c.opacity -= 5 : @menu_c.opacity = 100
@menu_d.opacity > 100 ? @menu_d.opacity -= 5 : @menu_d.opacity = 100
@menu_b.x > 650 ? @menu_b.x -= 4 : @menu_b.x = 650
@menu_a.x < 700 ? @menu_a.x += 4 : @menu_a.x = 700
@menu_c.x < 700 ? @menu_c.x += 4 : @menu_c.x = 700
@menu_d.x < 700 ? @menu_d.x += 4 : @menu_d.x = 700
when 2
@menu_c.opacity < 255 ? @menu_c.opacity += 5 : @menu_c.opacity = 255
@menu_a.opacity > 100 ? @menu_a.opacity -= 5 : @menu_a.opacity = 100
@menu_b.opacity > 100 ? @menu_b.opacity -= 5 : @menu_b.opacity = 100
@menu_d.opacity > 100 ? @menu_d.opacity -= 5 : @menu_d.opacity = 100
@menu_c.x > 650 ? @menu_c.x -= 4 : @menu_c.x = 650
@menu_b.x < 700 ? @menu_b.x += 4 : @menu_b.x = 700
@menu_a.x < 700 ? @menu_a.x += 4 : @menu_a.x = 700
@menu_d.x < 700 ? @menu_d.x += 4 : @menu_d.x = 700
when 3
@menu_d.opacity < 255 ? @menu_d.opacity += 5 : @menu_d.opacity = 255
@menu_a.opacity > 100 ? @menu_a.opacity -= 5 : @menu_a.opacity = 100
@menu_b.opacity > 100 ? @menu_b.opacity -= 5 : @menu_b.opacity = 100
@menu_c.opacity > 100 ? @menu_c.opacity -= 5 : @menu_c.opacity = 100
@menu_d.x > 650 ? @menu_d.x -= 4 : @menu_d.x = 650
@menu_b.x < 700 ? @menu_b.x += 4 : @menu_b.x = 700
@menu_c.x < 700 ? @menu_c.x += 4 : @menu_c.x = 700
@menu_a.x < 700 ? @menu_a.x += 4 : @menu_a.x = 700
end
end
end
def update_command
@command_index = 3 if @command_index == -1
@command_index = 0 if @command_index == 4
if Input.repeat?(Input::UP)
@command_index -= 1# if @command_index != 0
Audio.se_play("Audio/SE/se03.WAV")
return
end
if Input.repeat?(Input::DOWN)
@command_index += 1# if @command_index != 3
Audio.se_play("Audio/SE/se03.WAV")
return
end
if Input.trigger?(Input::C)
if @thelastpic.nil?
@thelastpic = Sprite.new
@thelastpic.bitmap = RPG::Cache.logo("msg2.png")
@thelastpic.opacity = 0
@thelastpic.z = 99
end
begin
Graphics.update
@thelastpic.opacity += 5
end until @thelastpic.opacity == 255
sleep 3
begin
Graphics.update
@thelastpic.opacity -= 5
end until @thelastpic.opacity == 0
return
end
end
def update_ani
case Graphics.frame_count
when 0
@random = [60+rand(40),100+rand(40),140+rand(40),180+rand(40),220+rand(40),260+rand(40)]
when @random[0]
@ani_con[7] = false
@anis[7].ani(200,400,990)
when @random[1]
@ani_con[8] = false
@anis[8].ani(200,600,988)
when @random[2]
@ani_con[9] = false
@anis[9].ani(200,400,989)
when @random[3]
@ani_con[5] = false
@anis[5].ani(200,400,991)
when @random[4]
@ani_con[4] = false
@anis[4].ani(200,400,993)
when @random[5]
@ani_con[6] = false
@anis[6].ani(0,400,995)
end
if !@anis[7].effect? and @ani_con[7] == false and Graphics.frame_count >= @random[0]
@anis[7].ani(430,680,999)
@ani_con[7] = true
end
if !@anis[8].effect? and @ani_con[8] == false and Graphics.frame_count >= @random[1]
@anis[8].ani(770,600,987)
@ani_con[8] = true
end
if !@anis[9].effect? and @ani_con[9] == false and Graphics.frame_count >= @random[2]
@anis[9].ani(800,232,989)
@ani_con[9] = true
end
if !@anis[5].effect? and @ani_con[5] == false and Graphics.frame_count >= @random[3]
@anis[5].ani(700,640,992)
@ani_con[5] = true
end
if !@anis[4].effect? and @ani_con[4] == false and Graphics.frame_count >= @random[4]
@anis[4].ani(820,410,994)
@ani_con[4] = true
end
if !@anis[6].effect? and @ani_con[6] == false and Graphics.frame_count >= @random[5]
@anis[6].ani(640,400,996)
@ani_con[6] = true
end
end
def 淡入(obj)
if obj.opacity == 255
case @phase
when 2
@wait = 100
@peple_bg = Sprite.new
@peple_bg.bitmap = @people1max
@peple_bg.x,@peple_bg.y,@peple_bg.z = 300,-98,7
@peple_bg.opacity = 255
when 4
@wait = 100
@peple_bg.bitmap = @people2max
@peple_bg.x = 0
@peple_bg.opacity = 255
when 6
@wait = 100
@peple_bg.bitmap = @people3max
@peple_bg.x = 300
@peple_bg.opacity = 255
end
@phase += 1
else
obj.opacity += 5 if obj.opacity < 255
end
end
end
复制代码
怎么让这脚本按新游戏图标进入游戏?要修改哪方面?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1