Project1
标题:
脚本里的=<<是什么符号,有什么用
[打印本页]
作者:
dongzi416
时间:
2013-10-27 19:44
标题:
脚本里的=<<是什么符号,有什么用
我在PC版黄金FINAL的脚本里看到的
代码如下:
class Scene_Begin
CREDIT=<<_b_
**英雄坛说**
_b_
end
class Scene_Begin
def initialize(return_scene = nil)
@sprite
= Sprite.new
@sprite.bitmap = Bitmap.new("Graphics/Pictures/blank.png")
@sprite.x = 0
@sprite.y = 0
end
def scene_start
credit_lines = CREDIT.split(/\n/)
@credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
credit_lines.each_index do |i|
line = credit_lines
@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.oy = -430
@frame_index = 0
@last_flag = false
end
def scene_end
@credit_bitmap.clear
@credit_sprite.dispose
@credit_bitmap.dispose
@sprite.dispose
end
def last?
return (@frame_index >= @credit_sprite.bitmap.height + 480)
end
def last
if not @last_flag
Audio.bgm_fade(3000)
@last_flag = true
@last_count = 0
else
@last_count += 1
end
if @last_count >= 15
command_new_game
end
end
def update
@frame_index += 1
return if cancel?
last if last?
@credit_sprite.oy += 1
end
def cancel?
if Input.trigger?(Input::B)
$scene = Scene_Create.new
return true
end
return false
end
def main
scene_start
Audio.bgm_play("Audio/bgm/begin.mp3")
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
scene_end
command_new_game
end
end
def command_new_game
Audio.bgm_stop
Graphics.frame_count = 0
$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
# 设置初期同伴位置
$game_party.setup_starting_members
# 设置初期位置的地图
$game_map.setup($data_system.start_map_id)
# 主角向初期位置移动
$game_player.moveto($data_system.start_x, $data_system.start_y)
# 刷新主角
$game_player.refresh
# 执行地图设置的 BGM 与 BGS 的自动切换
$game_map.autoplay
# 刷新地图 (执行并行事件)
$game_map.update
# 切换创建角色画面
$scene = Scene_Create.new
end
#==============================================================================
# 本脚本来自
www.66RPG.com
,使用和转载请保留此信息
#==============================================================================
这个脚本的作用是在游戏的开始打出移动字幕,但是开头的CREDIT=<<_b_
不懂是什么意思,=<<符号到底是干嘛的
作者:
无脑之人
时间:
2013-10-28 12:10
本帖最后由 无脑之人 于 2013-10-28 12:11 编辑
<< 标示符
文字
标示符
便于将大段文字转化为字符串
详见:
http://www.kuqin.com/rubycndocum ... 5.c6.a5.e9.a5.eb.29
作者:
dongzi416
时间:
2013-10-30 22:44
谢谢2L的好同志
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1