MV Black Room (类似于VA的Black room by VIPArcher)
近期移植的MV屋顶遮挡:https://rpg.blue/forum.php?mod=viewthread&tid=396305效果:
https://rpg.blue/data/attachment/forum/201609/19/214047jw9jc9d2lj968v8y.gif
把下面的代码存储为black_room.js,放进js/plugins/目录,然后在插件管理器里调用。
地图添加note:
https://rpg.blue/data/attachment/forum/201609/19/214042dm6dc3dvimc5sgvg.jpg
JAVASCRIPT 代码
"use strict"
/*:
* @plugindesc Black Room.
* @author Garfeng
*
* @param Tile Width
* @desc 一格的尺寸,默认48
* @default 48
*
* @param Padding
* @desc 内边距(0为全部填满颜色,我自用设为24)
* @default 0
*
* @param Fade Speed
* @desc 渐变速度
* @default 10
*
* @param Black Room Color
* @desc 遮盖层的颜色,比如 rgba(255,0,0,1) 代表红色
* @default rgba(0,0,0,1)
*
* @param Black Room Z
* @desc 遮盖层的z坐标
* @default 9999
*/
/* 使用方法:
* 地图添加注释,内部必须为数组的json格式
* [
* ,
*
* ]
*
* x1,y1 为左上角角点的坐标,x2,y2位右下角角点坐标
* 比如:我设置了三个区:
*
* [
* ,
* ,
*
* ]
*/
var Black_Room_RE = /([.\s\S]+)/i;
var parameters = PluginManager.parameters("black_room");
var FKCC = parseInt(parameters["Tile Width"]);
var BLACK_ROOM_PADDING = parseInt(parameters["Padding"]);
var BLACK_ROOM_FADE_SPEED = parseInt(parameters["Fade Speed"]);
var Black_Room_Color = parameters["Black Room Color"];
var Black_Room_Z = parseInt(parameters["Black Room Z"]);
var Garfeng_Spriteset_Map_initialize = Spriteset_Map.prototype.initialize;
Spriteset_Map.prototype.initialize = function(){
Garfeng_Spriteset_Map_initialize.call(this);
this.black_rooms = new Array();
this.black_rooms_sprite = new Array();
let str = $dataMap.note;
let match = Black_Room_RE.exec(str);
if(match != null){
try{
this.black_rooms = JSON.parse(match);
}catch(e){
console.error(e);
console.log(match);
}
if(this.black_rooms != null){
this.setupBlackRoom();
}
}
}
var Garfeng_Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function(){
Garfeng_Spriteset_Map_createLowerLayer.call(this);
};
Spriteset_Map.prototype.checkPosIn = function(sp){
let x = $gamePlayer._realX;
let y = $gamePlayer._realY;
if(x >= sp["x"] && x = sp["y"] && y
页:
[1]