使用区域id作为额外的图片展示,具体代码如下 
JAVASCRIPT 代码 - /*:
 -  * @plugindesc 区域图层插件
 -  * @author 雪在燃
 -  * v:1.2
 -  * @help
 -  *  区域图层插件
 -  * 使用地图备注编写打开该功能(注,设置为任意都将打开功能,只有删除该行才会关闭功能)
 -  * 以下是一个事例
 -  * 
 -  * 代表区域1会将img/system/pictures/light展示出来,并且不透明度为234(0~255,数字越低越不透明),z坐标为5(0~10,越高则越高,降低则会被主角或npc遮盖)
 - */
 - (function(){
 -     var old = Spriteset_Map.prototype.createLowerLayer;
 -     Spriteset_Map.prototype.createLowerLayer = function(){
 -         old.call(this);
 -         if($dataMap.meta.xzr_region){
 -             this.createShadowEx();
 -         }
 -     };
 -     Spriteset_Map.prototype.createShadowEx = function(){
 -         var data = null;//JSON.parse($dataMap.mate.set_region);
 -         for(var x = 0; x < $gameMap.width() ; x++){
 -             for(var y = 0; y < $gameMap.height() ; y++){
 -                 var id = $gameMap.regionId(x, y);
 -                 if(id != 0){
 -                     if($dataMap.meta["set_regionID_" + id]){
 -                         data = JSON.parse($dataMap.meta["set_regionID_" + id]);
 -                         var _sprite = new Sprite_Shadow(x, y, id, data);
 -                         this._tilemap.addChild(_sprite);
 -                     }
 -                 }
 -             }
 -         }
 -     }
 -     function Sprite_Shadow(x, y, id){
 -         this.initialize.apply(this, arguments);
 -     }
 -     Sprite_Shadow.prototype = Object.create(Sprite.prototype);
 -     Sprite_Shadow.prototype.constructor = Sprite_Shadow;
 -     Sprite_Shadow.prototype.initialize = function(x, y, id,data){
 -         Sprite.prototype.initialize.call(this);
 -         this.bitmap = (ImageManager.loadPicture(data[0]));
 -         this.opacity = data[1];
 -         this._dataZ = data[2];
 -         this._cWidth = 0;
 -         this._cHeight = 0;
 -         this._realX = x;
 -         this._realY = y;
 -         this._isReady = false;
 -         this.z = parseInt(id);
 -     }
 -     Sprite_Shadow.prototype.update = function(){
 -         Sprite.prototype.update.call(this);
 -         if(!this._isReady && ImageManager.isReady()){
 -             this._cWidth = (this.bitmap.width - 48) / 2;
 -             this._cHeight = (this.bitmap.height - 48) / 2;
 -             this._isReady = true;
 -         }
 -         this.updatePosition();
 -     }
 -     Sprite_Shadow.prototype.updatePosition = function()
 -     {
 -         this.z = this._dataZ;
 -         this.x = this.screenX();
 -         this.y = this.screenY();
 -     }
 -     Sprite_Shadow.prototype.scrolledX = function(){
 -         return $gameMap.adjustX(this._realX - 0.5);
 -     };
 -     Sprite_Shadow.prototype.scrolledY = function(){
 -         return $gameMap.adjustY(this._realY - 1);
 -     };
 -     Sprite_Shadow.prototype.screenX = function(){
 -         var tw = $gameMap.tileWidth();
 -         return Math.round((this.scrolledX() * tw + tw / 2)-this._cWidth);
 -     };
 -     Sprite_Shadow.prototype.screenY = function(){
 -         var th = $gameMap.tileHeight();
 -         return Math.round((this.scrolledY() * th + th)-this._cHeight);
 -     };
 - })();
 
  复制代码
初衷是作为光影脚本,如今并没有素材来实现这个功能wwww 
可以把图片作为图层插入到游戏里面,图片要是正方形,并且不能小于48*48,图片会以区域所在位置居中
   
用它来实现影子是个不错的选择!光效勉勉强强应该也可以用它实现,不过需要一个圆形的渐变光图片作为素材,作为额外图层可以用来修饰地图! 
对窗户用简单的光源修饰后~
  
             本帖来自P1论坛作者雪在燃,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=403790  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。  |