| 赞 | 168 |
| VIP | |
| 好人卡 | |
| 积分 | 229 |
| 经验 | |
| 最后登录 | 2025-4-1 |
| 在线时间 | 8598 小时 |
- 梦石
- 0
- 星屑
- 22879
- 在线时间
- 8598 小时
- 注册时间
- 2011-12-31
- 回帖
- 3270
|
发表于 2015-10-12 18:05:51
|
显示全部楼层
本帖最后由 tseyik 于 2015-10-12 21:15 编辑
上下黒帯描画判定開関10
#--------------------------------------------------------------------------
# ● 黒帯の作成
#--------------------------------------------------------------------------
def create_line
bitmap = Bitmap.new(Graphics.width, 39)
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, Color.new(0,0,0,255))
@up_line_sprite = Sprite.new(@viewport)
@down_line_sprite = Sprite.new(@viewport)
@up_line_sprite.bitmap = @down_line_sprite.bitmap = bitmap
@up_line_sprite.y = -39
@down_line_sprite.y = Graphics.height
end
#-----
イベント上下黒帯描画[pre lang="ruby"]=begin
RGSS3
★ イベント上下黒帯描画 ★
イベントが始まったら上下に黒いラインを描画し映画っぽくします。
ver1.00
Last Update : 2011/12/17
12/17 : RGSS2からの移植
ろかん http://kaisou-ryouiki.sakura.ne.jp/
=end
#===========================================
# 設定箇所
#===========================================
class Movie_Line
# 黒帯を描画するかどうかの判定スイッチ番号
BLS = 10
end
#===========================================
# ここまで
#===========================================
$rsi ||= {}
$rsi["イベント上下黒帯描画"] = true
class Movie_Line
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
create_viewport
create_line
end
#--------------------------------------------------------------------------
# ● ビューポートの作成
#--------------------------------------------------------------------------
def create_viewport
@viewport = Viewport.new
@viewport.z = 150
end
#--------------------------------------------------------------------------
# ● 黒帯の作成
#--------------------------------------------------------------------------
def create_line
bitmap = Bitmap.new(Graphics.width, 39)
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, Color.new(0,0,0,255))
@up_line_sprite = Sprite.new(@viewport)
@down_line_sprite = Sprite.new(@viewport)
@up_line_sprite.bitmap = @down_line_sprite.bitmap = bitmap
@up_line_sprite.y = -39
@down_line_sprite.y = Graphics.height
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@up_line_sprite.bitmap.dispose
@up_line_sprite.dispose
@down_line_sprite.bitmap.dispose
@down_line_sprite.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if $game_switches[BLS] && $game_map.interpreter.running?
move_visible_line
else
move_invisible_line
end
end
#--------------------------------------------------------------------------
# ● 黒帯の高さを取得
#--------------------------------------------------------------------------
def line_height
@up_line_sprite.bitmap.height
end
#--------------------------------------------------------------------------
# ● 黒帯を表示
#--------------------------------------------------------------------------
def move_visible_line
unless @up_line_sprite.y.zero?
@up_line_sprite.y = [@up_line_sprite.y + 3, 0].min
@down_line_sprite.y = Graphics.height - (line_height + @up_line_sprite.y)
end
end
#--------------------------------------------------------------------------
# ● 黒帯を非表示
#--------------------------------------------------------------------------
def move_invisible_line
unless @up_line_sprite.y == -line_height
@up_line_sprite.y = [@up_line_sprite.y - 3, -line_height].max
@down_line_sprite.y = Graphics.height - (line_height + @up_line_sprite.y)
end
end
end
class Spriteset_Map
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias black_line_initialize initialize
def initialize
create_line
black_line_initialize
end
#--------------------------------------------------------------------------
# ● 黒帯の作成
#--------------------------------------------------------------------------
def create_line
@movie_line = Movie_Line.new
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias black_line_dispose dispose
def dispose
dispose_line
black_line_dispose
end
#--------------------------------------------------------------------------
# ● 黒帯の解放
#--------------------------------------------------------------------------
def dispose_line
@movie_line.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias black_line_update update
def update
update_line
black_line_update
end
#--------------------------------------------------------------------------
# ● 黒帯の更新
#--------------------------------------------------------------------------
def update_line
@movie_line.update
end
end[/pre] |
|