1 class IntroEventScene < EventScene
2 def initialize(pics,splash,viewport=nil)
3 super(nil)
4 @pics=pics
5 @splash=splash
6 @pic=addImage(0,0,"")
7 @pic.moveOpacity(0,0,0) # fade to opacity 0 in 0 frames after waiting 0 frames
8 @pic2=addImage(0,322,"") # flashing "Press Enter" picture
9 @pic2.moveOpacity(0,0,0)
10 @index=0
11 data_system = pbLoadRxData("Data/System")
12 pbBGMPlay(data_system.title_bgm)
13 openPic(self,nil)
14 end
15
16 def openPic(scene,args)
17 onCTrigger.clear
18 @pic.name="Graphics/Titles/"+@pics[@index]
19 @pic.moveOpacity(15,0,255) # fade to opacity 255 in 15 frames after waiting 0 frames
20 pictureWait
21 @timer=0 # reset the timer
22 onUpdate.set(method(:timer)) # call timer every frame
23 onCTrigger.set(method(:closePic)) # call closePic when C key is pressed
24 end
25
26 def timer(scene,args)
27 @timer+=1
28 if @timer>80
29 @timer=0
30 closePic(scene,args) # Close the picture
31 end
32 end
33
34 def closePic(scene,args)
35 onCTrigger.clear
36 onUpdate.clear
37 @pic.moveOpacity(15,0,0)
38 pictureWait
39 @index+=1 # Move to the next picture
40 if @index>
[email protected]
41 openSplash(scene,args)
42 else
43 openPic(scene,args)
44 end
45 end
46
47 def openSplash(scene,args)
48 onCTrigger.clear
49 onUpdate.clear
50 @Animation = 1
51 @pic.name="Graphics/Titles/Splash/Splash_#{@Animation
52 @pic.moveOpacity(15,0,255)
53 @pic2.name="Graphics/Titles/start"
54 @pic2.moveOpacity(15,0,255)
55 pictureWait
56 onUpdate.set(method(:splashUpdate)) # call splashUpdate every frame
57 onCTrigger.set(method(:closeSplash)) # call closeSplash when C key is pressed
58 end
59
60 def splashUpdate(scene,args)
@timer+=1
@timer=0 if @timer>=80
@Animation+=1 if @Animation<16
@Animation = 1 if @Animation==16
@pic.name="Graphics/Titles/Splash/Splash_#{@Animation
if @timer>=32
@pic2.moveOpacity(0,0,8*(@timer-32))
else
@pic2.moveOpacity(0,0,255-(8*@timer))
end
if Input.press?(Input::DOWN) &&
Input.press?(Input::B) &&
Input.press?(Input::CTRL)
closeSplashDelete(scene,args)
end
end
def closeSplash(scene,args)
onCTrigger.clear
onUpdate.clear
# Play random cry
cry=pbResolveAudioSE(pbCryFile(1+rand(PBSpecies.maxValue)))
pbSEPlay(cry,100,100) if cry
# Fade out
@pic.moveOpacity(15,0,0)
@pic2.moveOpacity(15,0,0)
pbBGMStop(1.0)
pictureWait
scene.dispose # Close the scene
sscene=PokemonLoadScene.new
sscreen=PokemonLoad.new(sscene)
sscreen.pbStartLoadScreen
end
def closeSplashDelete(scene,args)
onCTrigger.clear
onUpdate.clear
# Play random cry
cry=pbResolveAudioSE(pbCryFile(1+rand(PBSpecies.maxValue)))
pbSEPlay(cry,100,100) if cry
# Fade out
@pic.moveOpacity(15,0,0)
@pic2.moveOpacity(15,0,0)
pbBGMStop(1.0)
pictureWait
scene.dispose # Close the scene
sscene=PokemonLoadScene.new
sscreen=PokemonLoad.new(sscene)
sscreen.pbStartDeleteScreen
end
end
class Scene_Intro
def initialize(pics, splash = nil)
@pics=pics
@splash=splash
end
def main
Graphics.transition(0)
@eventscene=IntroEventScene.new(@pics,@splash)
@eventscene.main
Graphics.freeze
end
end