Another Scrolling Text Script - kyonides - 03-07-2008
This is my version of the scrolling text script, it's supposed to be used whenever you want to show the credits, to display an intro that may include a prologue and some picture above... or you just want to create an intro every time a new episode / chapter begins in your game.
Features:
If you press Cancel button or there is no more lines to be displayed, it will be closed automatically.
Instructions:
In a script call enter this line
$scene = Scroll.new(1) or $scene = Scroll.new(1, 1)
Do you need to change the text? No problem. Just go to Text module and edit the Intro or Chapter_1 lines I enter as an example.
Note:
This is a Scrolling Window Script actually he he he he
Code: module Text
Intro = {
100 => 'Sentence 1',
101 => 'this does not mean anything',
102 => 'Sentence 3',
103 => 'Sentence 4',
104 => 'Sentence 5',
105 => '',
106 => 'Sentence 6',
107 => 'Sentence 7',
108 => 'Sentence 8',
109 => 'Sentence 9',
110 => 'just another line of text',
111 => 'Sentence 11',
112 => "I don't know what I'm doing here",
113 => '',
114 => 'New Paragraph: Make up something else',
115 => 'The Last Sentence'
}
Chapter_1 = {
100 => 'Sentence 1',
101 => 'this does not mean anything',
102 => 'Sentence 3',
103 => 'Sentence 4',
104 => 'Sentence 5',
105 => '',
106 => 'Sentence 6',
107 => 'Sentence 7',
108 => 'Sentence 8',
109 => 'Sentence 9',
110 => 'just another line of text',
111 => 'Sentence 11',
112 => "I don't know what I'm doing here",
113 => '',
114 => 'New Paragraph: Make up something else',
115 => 'The Last Sentence'
}
end
#=====================================================
# * Scrolling Text v 1.0
# by shadowball
# 01.14.2008
#=====================================================
class Scrolling_Text < Window_Base
def initialize(index)
@index = index
super(0, 0, 440, 636)
self.contents = Bitmap.new(width - 32, height - 32)
case index
when 0
@text = Text::Intro
when 1
self.contents.font.color = gold_color
@text = Text::Chapter_1
end
y = -32
@text.sort.each do |keys, values|
y += 32
self.contents.draw_text(0,y,488,32, values)
end
self.opacity = 0
refresh
end
def refresh
self.y -= 1 if self.y > -544
end
end
Code: #=====================================================
# * Scroll (Scene) v 1.0
# by shadowball
# 01.14.2008
#=====================================================
class Scroll
def initialize(index = 0, pic = 0)
@index = index
@pic = pic
end
def main
@sprite1 = Sprite.new
@sprite1.bitmap = RPG::Cache.picture('this is a wall paper')
@sprite2 = Sprite.new
if @pic == 1
@sprite2.bitmap = RPG::Cache.picture('any image')
@sprite2.z = 250
end
if @index == 0
@shb_scroll_window = Scrolling_Text.new(0)
elsif @index == 1
@shb_scroll_window = Scrolling_Text.new(1)
end
@shb_scroll_window.x = 100
@shb_scroll_window.y = 480
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@shb_scroll_window.dispose
@sprite1.dispose
@sprite1.bitmap.dispose
if @pic == 1
@sprite2.dispose
@sprite2.bitmap.dispose
end
end
def update
# Update windows
@shb_scroll_window.refresh
if @pic == 0
if @shb_scroll_window.y == -636
$scene = Scene_Map.new
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
elsif @pic == 1
if @shb_scroll_window.y == -360
$scene = Scene_Map.new
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
end
# This would allow you to use it just after you start a new game
class Scene_Title
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scroll.new
end
end
Another Scrolling Text Script - Shiroiyuki - 04-12-2010
Does anyone know how I get the words to scroll slower?
This goes RAPID across my screen. Works just fine otherwise but.....is there maybe a way to delay the beginning from playing (to allow the user to see the background picture for a few moments), slow down the words (so we can actually read them, yikes), and perhaps sit and wait on the last paragraph (or line of text) until the user hit 'ENTER' or any key...?
That would make it seem more like an intro, in my opinion.
|