幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2189|回复: 3

字幕系统脚本

[复制链接]

1

主题

1

帖子

103

积分

③业余

严谨第一

积分
103
发表于 2004-10-31 15:46:41 | 显示全部楼层 |阅读模式
在main上面新建一个Scene_Credit,然后贴入下面的代码

在游戏中加入一个事件,然后加入脚本$scene= Scene_Credit.new()调用

效果很不错的


# Scene_Credit
#
# 制作人员名单
#

class Scene_Credit
  CREDIT=<<_END_
Cast

制作工具RPGmakerXP

字幕系统(完毕后自动返回地图)
如果想作为谢幕用,请修改return_scene = Scene_Map.new
为return_scene = Scene_Title.new


_END_
end

class Scene_Credit

  def initialize(return_scene = nil)
    if return_scene.nil?
      return_scene = Scene_Map.new
    end
    @return_scene = return_scene
  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_sprite.dispose
  end
  
  def last?
    return (@frame_index >= @credit_sprite.bitmap.height + 480)
  end
  
  def last
    if not @last_flag
      Audio.bgm_fade(10000)
      @last_flag = true
      @last_count = 0
    else
      @last_count += 1
    end
    if @last_count >= 300
      $scene = @return_scene
    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 = @return_scene
      return true
    end
    return false
  end

  def main
    scene_start
    # 过渡
    Graphics.transition
    # 主循环
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    scene_end
  end
end

# Scene_Credit

回复

使用道具 举报

122

主题

3385

帖子

8590

积分

⑦老手

积分
8590
发表于 2004-10-31 16:04:55 | 显示全部楼层
楼主的头像是四代目吧
回复 支持 反对

使用道具 举报

25

主题

242

帖子

2072

积分

⑥精研

不正经的大叔

积分
2072
发表于 2004-10-31 16:50:15 | 显示全部楼层
你的头像是X代目~
计划2006年复出。。
回复 支持 反对

使用道具 举报

3

主题

45

帖子

795

积分

⑤进阶

-累-人

积分
795
发表于 2004-11-1 20:20:10 | 显示全部楼层
我想问个问题!
当脚本运行中你按X键会怎么样?
我按就会出错
...
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-8 14:41 , Processed in 0.012817 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表