Code:
#==============================================================================
# Scene_Credits
#Author: Paul Baker, Midas Mike, and Unknown
#Version: 2
# -Stopped when over
# -Added overlay
# -Added Cutscene Functionality
#------------------------------------------------------------------------------
#What you do is use $scene = Scene_Credits.new to
#start scrolling the credits over the map screens.
#the only functions that don't work are the ones
#that involve messages, debug, battle, shop, menu,
#save, or name changing screen.
#The ones that do are
#Teleporting, ScreenColor, and Audio playing.
#==============================================================================
module AMK_CREDITS
CREDITS_FONT = ["Calligraph421 BT", "Viner Hand ITC", "Arial", "Times New Roman"]
CREDITS_SIZE = 24
CREDITS_OUTLINE = Color.new(0,0,127, 255)
CREDITS_SHADOW = Color.new(0,0,0, 100)
CREDITS_FILL = Color.new(255,255,255, 255)
CUTSCENE_ENABLED = true #Turns on and off map functionality
CANCEL_ENABLED = false #works if and only if Cutscene is disabled
OVERLAY_ENABLED = true #enables the overlay, works for both
end
class Scene_Credits
# This next piece of code is the credits.
#Start Editing
CREDIT=<<_END_
Credits Script DEMO Ver 2
Director
---------------
Paul Baker
Scripts
---------------
Unknown
MiDas Mike
re-re-revisied for cutscene uses, Paul Baker (AvatarMonkeyKirby)
Graphics
---------------
Enterbrain::RTP
Music and sound
---------------
Enterbrain::RTP
Mapping and Eventing
---------------
Enterbrain
Paul Baker
Storyline
---------------
Sadly, Paul Baker
Beta Testers
---------------
Paul Baker
Special Thanks
---------------
Other Thanks
---------------
All to Paul Baker and the
remade credits script to
work with cutscenes, so
yeah.
Sincerely, Your Beloved
_END_
#Stop Editing
def main
if !AMK_CREDITS::CUTSCENE_ENABLED
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
end
#Scene Map instances
@spriteset = Spriteset_Map.new
#-------------------------------
# Animated Background Setup
#-------------------------------
@sprite = Sprite.new
@backgroundGameFrameCount = 0
@backgroundG_BFrameCount = 3.4
#-------------------------------
# Credits Overlay Setup
#-------------------------------
if AMK_CREDITS::OVERLAY_ENABLED
@overlay = Sprite.new
@overlay.bitmap = RPG::Cache.picture("Credits_Overlay")
@overlay.x = 0
@overlay.y = 0
@overlay.z = 1000
end
#------------------
# Credits txt Setup
#------------------
credit_lines = CREDIT.split(/\n/)
credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
credit_lines.each_index do |i|
line = credit_lines[i]
credit_bitmap.font.name = AMK_CREDITS::CREDITS_FONT
credit_bitmap.font.size = AMK_CREDITS::CREDITS_SIZE
x = 0
credit_bitmap.font.color = AMK_CREDITS::CREDITS_OUTLINE
credit_bitmap.draw_text(0 + 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 + 1,640,32,line,1)
credit_bitmap.draw_text(0 + 1,i * 32 - 1,640,32,line,1)
credit_bitmap.draw_text(0 - 1,i * 32 - 1,640,32,line,1)
credit_bitmap.font.color = AMK_CREDITS::CREDITS_SHADOW
credit_bitmap.draw_text(0,i * 32 + 8,640,32,line,1)
credit_bitmap.font.color = AMK_CREDITS::CREDITS_FILL
credit_bitmap.draw_text(0,i * 32,640,32,line,1)
end
@credit_sprite = Sprite.new(Viewport.new(0,50,640,380))
@credit_sprite.bitmap = credit_bitmap
@credit_sprite.z = 9998
@credit_sprite.oy = -430 #-430
@frame_index = 0
@last_flag = false
#--------
# Audio Setup
#--------
Audio.me_stop
Audio.bgs_stop
Audio.se_stop
Graphics.transition
loop do
Graphics.update
Input.update
update
# if the scene is changed
if $scene != self
break
end
end
# disposes the sprites
Graphics.freeze
@spriteset.dispose
#@message_window.dispose
@sprite.dispose
if AMK_CREDITS::OVERLAY_ENABLED
@overlay.dispose
end
@credit_sprite.dispose
end
##Checks if credits bitmap has reached it's ending point
def last?
if @frame_index > (@credit_sprite.bitmap.height + 500)
Audio.bgm_fade(10000) #aprox 10 seconds
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
$scene = Scene_Map.new
return true
end
return false
end
##Checks if player can cancel the credits
def cancel?
if Input.trigger?(Input::C) || Input.trigger?(Input::B) and AMK_CREDITS::CANCEL_ENABLED
Audio.bgm_fade(10000) #aprox 10 seconds
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
$scene = Scene_Map.new
return true
end
return false
end
#--------------------------------------------------------------------------
# Updates the scene
#--------------------------------------------------------------------------
def update
@backgroundGameFrameCount = @backgroundGameFrameCount + 1
if @backgroundGameFrameCount >= @backgroundG_BFrameCount
@backgroundGameFrameCount = 0
# Add current background frame to the end
# and drop it from the first position
end
return if cancel?
return if last?
@credit_sprite.oy += 1 #this is the speed that the text scrolls. 1 is default
#The fastest I'd recomend is 5, after that it gets hard to read.
@frame_index += 1 #This should fix the non-self-ending credits
#Scene Map Instances
loop do
$game_map.update
$game_system.map_interpreter.update
#$game_player.update #character movement
$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.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name)
end
end
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
case $game_temp.player_new_direction
when 2 # down
$game_player.turn_down
when 4 # left
$game_player.turn_left
when 6 # right
$game_player.turn_right
when 8 # up
$game_player.turn_up
end
$game_player.straighten
$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
#$game_map.autoplay #disabled so music won't change when the map does.
Graphics.frame_reset
Input.update
end
end
end #Ends the scene