Skip to content

Instantly share code, notes, and snippets.

@cacao-soft
Last active May 30, 2021 03:50
Show Gist options
  • Save cacao-soft/1b5482ad6b673efe13f2ea1a8b570e1b to your computer and use it in GitHub Desktop.
Save cacao-soft/1b5482ad6b673efe13f2ea1a8b570e1b to your computer and use it in GitHub Desktop.
RGSS3 戦闘背景にマップ
# 戦闘背景となるマップ画像を加工せずに表示します。
# 戦闘背景の床の設定が なし 場合、直前のマップ画像を背景とします。
class << SceneManager
#--------------------------------------------------------------------------
# ● 背景として使うためのスナップショット作成
#--------------------------------------------------------------------------
def snapshot_for_background
@background_bitmap.dispose if @background_bitmap
@background_bitmap = Graphics.snap_to_bitmap
@background_bitmap.blur unless scene_is?(Scene_Battle)
end
end
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● マップ画面を加工した戦闘背景用ビットマップの作成
#--------------------------------------------------------------------------
def create_blurry_background_bitmap
source = SceneManager.background_bitmap
bitmap = Bitmap.new(640, 480)
bitmap.stretch_blt(bitmap.rect, source, source.rect)
bitmap
end
#--------------------------------------------------------------------------
# ● 戦闘背景(床)ファイル名の取得
#--------------------------------------------------------------------------
def battleback1_name
if $BTEST
$data_system.battleback1_name
elsif $game_map.battleback1_name
$game_map.battleback1_name.tap {|fn| break if fn.empty? }
elsif $game_map.overworld?
overworld_battleback1_name
end
end
end
@cacao-soft
Copy link
Author

cacao-soft commented May 7, 2021

背景をぼかす

SceneManager.snapshot_for_background の定義は不要

背景を画面サイズに合わせる

背景を等倍にするには、ここのサイズを変更する。
ダメージを受けたときなど、画面シェイク時に画面端に黒いとこ出ます。

bitmap = Bitmap.new(Graphics.width, Graphics.height)

背景を暗くする

stretch_blt の最後に引数を追加する

bitmap.stretch_blt(bitmap.rect, source, source.rect, 200)

@cacao-soft
Copy link
Author

タイルセットのモードがエリアタイプの場合、特に設定を変更することなくマップ画像が使用されると思います。
フィールドタイプの場合は、マップの設定やイベントコマンドで戦闘背景の変更を行ない床をなしに設定する必要があります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment