2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RPGツクールMVプラグイン サブタイトル

Last updated at Posted at 2016-08-24

安くなってたので買ってみました。
プラグインがjsで書けるということでいろいろプラグインを書いてまとめておこうと思います。
早速練習がてらサブタイトルを表示するプラグインを書いてみました。
サブタイトル.png

/*:ja
 * メモ: イメージはimg/systemフォルダ内に保存されます。
 *
 * @plugindesc サブタイトルを表示します。
 * @author Korokoro
 *
 * @help  このプラグインにはプラグインコマンドはありません。
 *
 * @param SubTitle
 * @desc サブタイトル
 * @default 〜サブタイトル〜
 *
 * @param OffsetX
 * @desc オフセットX
 * @default 0
 *
 * @param OffsetY
 * @desc オフセットY
 * @default 50
 *
 * @param FontSize
 * @desc フォントサイズ
 * @default 36
 *
 */

var Korokoro = Korokoro || {};
Korokoro.SubTitle = {};
Korokoro.SubTitle.Parameters = PluginManager.parameters('SubTitle');

Korokoro.SubTitle.SubTitle = String(Korokoro.SubTitle.Parameters["SubTitle"]);
Korokoro.SubTitle.OffsetX = Number(Korokoro.SubTitle.Parameters["OffsetX"]) || 0;
Korokoro.SubTitle.OffsetY = Number(Korokoro.SubTitle.Parameters["OffsetY"]) || 50;
Korokoro.SubTitle.FontSize = Number(Korokoro.SubTitle.Parameters["FontSize"]) || 36;

(function() {
	var drawGameTitle = Scene_Title.prototype.drawGameTitle;
	Scene_Title.prototype.drawGameTitle = function() {
		drawGameTitle.call(this);

		var x = 20;
	    var y = Graphics.height / 4 + Korokoro.SubTitle.OffsetY;
	    var maxWidth = Graphics.width - x * 2;
	    var text = Korokoro.SubTitle.SubTitle;
	    this._gameTitleSprite.bitmap.outlineColor = 'black';
	    this._gameTitleSprite.bitmap.outlineWidth = 8;
	    this._gameTitleSprite.bitmap.fontSize = Korokoro.SubTitle.FontSize;
	    this._gameTitleSprite.bitmap.drawText(text, x + Korokoro.SubTitle.OffsetX, y, maxWidth + Korokoro.SubTitle.OffsetX, 48, 'center');
	};
})();

デフォルトで入っていたMadeWithMv.jsを改変してみたところ想像以上に簡単に書けました。
基本的にこんな感じでprototypeで既存関数を上書きするのかな。
jsフォルダを見れば全部中身が分かるようなのでなんでもできそう。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?