查看: 12672|回复: 20

[原创发布] 【自用·测试】图块遮挡角色半透明

[复制链接]
梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
发表于 2016-1-2 10:19:16 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 andrewx 于 2016-1-2 10:37 编辑

各位新年快乐噜~
这次是为了练习处理sprite写的插件,能实现被图块遮挡的角色呈现半透明的效果,帮助玩家确认被遮挡的角色的位置。原理很简单,就是为所有的角色(包括主角,跟随队友,事件,交通工具)在与高层图块相同的层级(z = 4)上建立半透明的sprite。感谢@汪汪 之前提供的思路。

截图:
TCBT01.png


食用方法:

1. 安装:直接在插件管理器中启用。

2. 设定参数:

Default Opacity Rate:
图块上半透明角色sprite的不透明度将为Opacity Rate与角色原本的不透明度的乘积。此处设定的是默认的Opacity Rate。
有效参数是[0, 1]之间的小数。
本参数默认值为0.2。

Opacity Percentage Variable ID:
你也可以使用一个游戏内变量来动态地控制高层角色sprite。本参数接收一个游戏内变量的ID,sprite的不透明度将由该变量的值决定。由于RM中内建游戏变量只能是整数,所以变量里的有效值为百分比的整数部分,即在[0, 100]之间的整数。实际Opacity Rate将为该值除以100。
如果你使用变量控制不透明度,那么Default Opacity Rate将被忽略。记得调节相应的变量数值以使高层sprite生效。
该参数设定为0表示不启用这项功能。
本参数默认值为0。

Enable by Default:
设定高层角色sprite是否默认起效。如果设定为false,那么默认不会显示任何高层角色sprite。你需要使用下面的插件指令或事件注释标签来手动开启。
本参数默认值为true。

3. 插件指令:
插件指令可以临时调整某角色上是否显示高层sprite。

  1. HighLayerCharacterSprite EventID true       #开启以EventID为ID的事件的高层角色sprite
复制代码

  1. HighLayerCharacterSprite EventID false       #关闭以EventID为ID的事件的高层角色sprite
复制代码


其中EventID为-1时代表主角和跟随队友,0为当前事件,或者其他具体事件ID。

4. 事件注释标签
通过设置事件注释标签可以修改某事件默认是否显示高层角色sprite。
注意这里的事件注释标签不是事件窗口上方的备注(Note)区,而是事件执行内容内通过流程控制->注释(comment)指令加入的注释内容。使用事件注释而非备注可以允许你为同一个事件的不同页面定义不同的高层角色sprite的可见性。你可以在注释指令里使用如下标签(包括尖括号):

  1. <Enable High Layer Character Sprite>       #开启这个事件的高层角色sprite
复制代码
  1. <Disable High Layer Character Sprite>       #关闭这个事件的高层角色sprite
复制代码

TCBT02.png


注意事项:
    对于事件,插件指令和事件注释标签的效果将持续到地图切换,对于主角和队友效果则切换地图后依然持续。

    插件指令和事件注释标签的效果会互相覆盖。

    当某事件的某一页被激活,该页面的事件注释标签就会被执行,假如该页没有定义标签,那么高层角色sprite的可见性维持不变。

    副作用:角色重叠的话半透明的sprite也会重叠在一起…这个目前感觉无解,如果有解决思路可以留言,谢~


TCBT03.png
TCBT04.png

插件内容:
Ver 0.10

  1. //=============================================================================
  2. // AndrewX - Translucent Character Behind Tile
  3. // AndrewX_TranslucentCharacterBehindTile.js
  4. //=============================================================================
  5. var AndrewX = AndrewX || {};
  6. AndrewX.TCBT = AndrewX.TCBT || {};
  7. //=============================================================================
  8. /*:
  9. * @plugindesc v0.10 Display a translucent character sprite when the character is behind a tile.
  10. * @author AndrewX
  11. *
  12. * @param Default Opacity Rate
  13. * @desc The default opacity rate for high layer character sprites. (Default: 0.2)
  14. * @default 0.2
  15. *
  16. * @param Opacity Percentage Variable ID
  17. * @desc Set a variable ID to use that variable to control opacity rate. Use 0 if you do not need this feature. (Default: 0)
  18. * The real opacity rate will be the value of that variable divide by 100.
  19. * @default 0
  20. *
  21. * @param Enable by Default
  22. * @desc Set to "false" if you do not want high layer sprite to be displayed by default. (Default: true)
  23. * @default true
  24. *
  25. * @help
  26. * ============================================================================
  27. * Introduction and Instructions
  28. * ============================================================================
  29. *
  30. * This plugin will create high layer translucent sprites for characters
  31. * (player, followers, events, vehicles), which are at the same layer as upper
  32. * tiles (i.e. z = 4), so that when a character is covered by the tile, the
  33. * high layer translucent sprite will indicate where he is.
  34. *
  35. * Usage:
  36. * 1. Installed: Just enable the plugin in the Plugin Manager.
  37. *
  38. * 2. Setup parameters.
  39. *  a. Default Opacity Rate:
  40. *      The opacity for the high layer character sprites will be the product
  41. *      of the character's original opacity and the opacity rate you set in
  42. *      this plugin. This parameter is the default opacity rate.
  43. *      Valid value will be a number in range [0, 1].
  44. *      The default value for this parameter is 0.2.
  45. *  b. Opacity Percentage Variable ID:
  46. *      You can also use a variable to get dynamic control of the high layer
  47. *      sprites' opacity. This parameter takes in a variable ID in your game,
  48. *      and the opacity will be determined by the value of that variable.
  49. *      Note: As in RM, builtin variables only support integers. Thus, the
  50. *      valid value in the variable is a percentage number in range [0, 100].
  51. *      The actual opacity rate will be the variable's value divide by 100.  
  52. *      If you use the variable to control opacity, the Default Opacity Rate
  53. *      will be ignored. Remember to adjust the variable you assigned to make
  54. *      the sprites to work.
  55. *      Use 0 if you do not need this feature.
  56. *      The default value for this parameter is 0.
  57. *  c. Enable by Default:
  58. *      Whether the high layer sprites should work by default. If you set to
  59. *      "false", no high layer character sprite will be displayed
  60. *      automatically. You need to enable them manually by plugin commands or
  61. *      event comment tags.
  62. *      The default value for this parameter is true.
  63. *      
  64. * 3. Plugin Commands:
  65. *  Use plugin commands to modify high layer character sprite's visibility of
  66. *  an event temporarily:
  67. *        
  68. *      HighLayerCharacterSprite EventID true
  69. *      # Enable high layer sprite for the event
  70. *         
  71. *      HighLayerCharacterSprite EventID false
  72. *      # Disable high layer sprite for the event
  73. *
  74. *          EventID = number for specific event
  75. *          EventID = 0 for "this" event
  76. *          EventID = -1 for player and followers
  77. *
  78. * 4. Event Comment Tags
  79. *  You can use event comment tags to set whether an event should display
  80. *  high layer character sprite by default.
  81. *  Event Comment Tags are set within comments in event contents of an event
  82. *  page. This will enable you to set different translucent sprite visibilities
  83. *  in different pages for the same event.
  84. *  
  85. *      <Enable High Layer Character Sprite>
  86. *      # Enable high layer sprite for this event
  87. *
  88. *      <Disable High Layer Character Sprite>
  89. *      # Disable high layer sprite for this event
  90. *
  91. *  To use these tags, in an event page, add Event Commands "Comment" in Flow
  92. *  Control, and write the tag.
  93. *
  94. * NOTE:
  95. *  1. For events, the effect of plugin commands and event comment tags will
  96. *  last until the map is changed. For player and followers, the effect will
  97. *  remain.
  98. *  2. Plugin commands and event comment tags can override each other.
  99. *  3. Every time an event page is triggered, the event comment tag within
  100. *  this page will be evaluated. If there is no defined comment tag, the
  101. *  visibility of the high layer character sprite will not be changed.
  102. *
  103. * ============================================================================
  104. * Changelog
  105. * ============================================================================
  106. *
  107. * Version 0.10:
  108. * - Finished prototype
  109. *
  110. * ============================================================================
  111. * Term of Use
  112. * ============================================================================
  113. *
  114. * Free for use in non-commercial or commercial RMMV projects
  115. * Please credit AndrewX
  116. *
  117. */
  118. //=============================================================================

  119. (function() {

  120.         var parameters = PluginManager.parameters('AndrewX_TranslucentCharacterBehindTile');
  121.         var defaultOpacityRate = Number(parameters['Default Opacity Rate'] || 0);
  122.         var opacityVariableId = Number(parameters['Opacity Percentage Variable ID'] || 0);
  123.         var enableByDefault = parameters['Enable by Default'];

  124.         AndrewX.TCBT.initMembers = Game_CharacterBase.prototype.initMembers;
  125.         Game_CharacterBase.prototype.initMembers = function() {
  126.                 AndrewX.TCBT.initMembers.call(this);
  127.                 if (enableByDefault.toUpperCase() === 'FALSE') {
  128.                         this._showHighLayerCharaSprite = false;
  129.                 } else {
  130.                         this._showHighLayerCharaSprite = true;
  131.                 }
  132.         };

  133.         AndrewX.TCBT.createCharacters = Spriteset_Map.prototype.createCharacters;
  134.         Spriteset_Map.prototype.createCharacters = function() {
  135.                 AndrewX.TCBT.createCharacters.call(this);
  136.                 this._highLayerCharaSprites = [];
  137.                 $gameMap.events().forEach(function(event) {
  138.                         this._highLayerCharaSprites.push(new Sprite_Character(event));
  139.                 }, this);
  140.                 $gameMap.vehicles().forEach(function(vehicle) {
  141.                         this._highLayerCharaSprites.push(new Sprite_Character(vehicle));
  142.                 }, this);
  143.                 $gamePlayer.followers().reverseEach(function(follower) {
  144.                         this._highLayerCharaSprites.push(new Sprite_Character(follower));
  145.                 }, this);
  146.                 this._highLayerCharaSprites.push(new Sprite_Character($gamePlayer));
  147.                 for (var i = 0; i < this._highLayerCharaSprites.length; i++) {
  148.                         this._tilemap.addChild(this._highLayerCharaSprites[i]);
  149.                 }
  150.         };

  151.         AndrewX.TCBT.update = Spriteset_Map.prototype.update;
  152.         Spriteset_Map.prototype.update = function() {
  153.                 AndrewX.TCBT.update.call(this);
  154.                 var characters = this._characterSprites;
  155.                 for (var i = 0; i < characters.length; i++) {
  156.                         if (!this._highLayerCharaSprites[i]) {
  157.                                 continue;
  158.                         }
  159.                         this._highLayerCharaSprites[i].z = 4;
  160.                         var opacityRate;
  161.                         if (opacityVariableId >= 1) {
  162.                                 opacityRate = $gameVariables.value(opacityVariableId) / 100;
  163.                         } else {
  164.                                 opacityRate = defaultOpacityRate;
  165.                         }
  166.                         this._highLayerCharaSprites[i].opacity = characters[i].opacity * opacityRate;
  167.                         if (characters[i]._character._showHighLayerCharaSprite === true) {
  168.                                 this._highLayerCharaSprites[i].visible = characters[i].visible;
  169.                         } else {
  170.                                 this._highLayerCharaSprites[i].visible = false;
  171.                         }
  172.                 }
  173.         };

  174.         AndrewX.TCBT.pluginCommand = Game_Interpreter.prototype.pluginCommand;
  175.         Game_Interpreter.prototype.pluginCommand = function(command, args) {
  176.                 AndrewX.TCBT.pluginCommand.call(this, command, args);
  177.                 if (command.toUpperCase() === 'HIGHLAYERCHARACTERSPRITE') {
  178.                         if (eval(args[0]) < 0) {
  179.                                 if (args[1].toUpperCase() === 'TRUE') {
  180.                                         $gamePlayer._showHighLayerCharaSprite = true;
  181.                                         $gamePlayer.followers().reverseEach(function(follower) {
  182.                                                 follower._showHighLayerCharaSprite = true;
  183.                                         }, this);
  184.                                 } else if (args[1].toUpperCase() === 'FALSE') {
  185.                                         $gamePlayer._showHighLayerCharaSprite = false;
  186.                                         $gamePlayer.followers().reverseEach(function(follower) {
  187.                                                 follower._showHighLayerCharaSprite = false;
  188.                                         }, this);
  189.                                 }
  190.                         } else {
  191.                                 subject = this.character(eval(args[0]));
  192.                                 if (args[1].toUpperCase() === 'TRUE') {
  193.                                         subject._showHighLayerCharaSprite = true;
  194.                                 } else if (args[1].toUpperCase() === 'FALSE') {
  195.                                         subject._showHighLayerCharaSprite = false;
  196.                                 }
  197.                         }
  198.                 }
  199.         };

  200.         AndrewX.TCBT.setupPage = Game_Event.prototype.setupPage;
  201.         Game_Event.prototype.setupPage = function() {
  202.                 AndrewX.TCBT.setupPage.call(this, arguments);
  203.                 if (this._pageIndex >= 0) {
  204.                         for (var i = 0; i < this.list().length; i++) {
  205.                                 if ([108, 408].indexOf(this.list()[i]['code']) >= 0) {
  206.                                         var note = this.list()[i]['parameters'][0];
  207.                                         if (note.match(/<Disable High Layer Character Sprite>/i)) {
  208.                                                 this._showHighLayerCharaSprite = false;
  209.                                         } else if (note.match(/<Enable High Layer Character Sprite>/i)) {
  210.                                                 this._showHighLayerCharaSprite = true;
  211.                                         }
  212.                                 }
  213.                         }
  214.                 }
  215.         }
  216. })();
复制代码



自吐槽:为毛这么简单一个效果做这么多设定选项,根本不会有人调整这玩意儿。。。都说了是在练习插件的写法啦XD

评分

参与人数 2星屑 +300 梦石 +1 收起 理由
余烬之中 + 1 原创发布
taroxd + 300 精品文章

查看全部评分

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
回帖
403
发表于 2016-1-2 10:25:29 | 显示全部楼层
哎哟不错喔
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2016-1-2 11:52:37 | 显示全部楼层
Default Opacity Rate:
图块上半透明角色sprite的不透明度将为Opacity Rate与角色原本的不透明度的乘积。此处设定的是默认的Opacity Rate。
有效参数是[0, 1]之间的小数。
本参数默认值为0.2。
对这种参数我觉得
设置为 0 - 255
在脚本里对这个数除以255
这样比较好.

评分

参与人数 1星屑 +5 收起 理由
夏末渐离 + 5 我很赞同

查看全部评分

回复

使用道具 举报

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
回帖
403
发表于 2016-1-2 13:56:11 | 显示全部楼层
本帖最后由 夏末渐离 于 2016-1-2 14:09 编辑

关于副作用,想到一个笨方法

  1. if (characters[i]._character._showHighLayerCharaSprite === true&&characters[i]._character.regionId()==1)
  2. this._highLayerCharaSprites[i].visible = characters[i].visible;
复制代码



原本想法是获取【可通过的高层图块的XY】,然后与角色们的当前XY值比较,相等则绘制半透明,不等则不绘制。

因为不懂如何获取【可通过的高层图块的XY】,而且每一帧都要获取角色们的XY值会觉得很卡。

便直接用地区ID判定,只能辛苦使用这个插件的人去设置【可通过的高层图块的地区ID】了。

  点我进入    
       ↓      
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2016-1-2 14:51:54 | 显示全部楼层
汪汪 发表于 2016-1-2 11:52
Default Opacity Rate:
图块上半透明角色sprite的不透明度将为Opacity Rate与角色原本的不透明度的乘积。此 ...

感谢提出建议,但是我使用0~1的比值是希望这个半透明的sprite的不透明度是基于角色实际不透明度计算得出的,比如Opacity Rate=0.2时,如果角色本身不透明度255,那么实际不透明度为51,如果角色的不透明度变成了100,那么半透明sprite的透明度则自动变为20。如果参数得当,就不会出现半透明sprite比角色原本sprite还明显的情况。
如果按照0~255来设置,会给使用者一种这是在设定半透明sprite的真实不透明度的印象,毕竟本身设置Opacity就是0~255这么设置的。
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2016-1-2 15:04:58 | 显示全部楼层
夏末渐离 发表于 2016-1-2 13:56
[fold=关于副作用,想到一个笨方法]

if (characters._character._showHighLayerCharaSprite === true&&cha ...

感谢提供思路~确实可以这样避免平时角色重叠的问题,但是在高层图块后面重叠的话还是会糊在一起囧。其实我觉得Opacity Rate不设的太离谱重叠在一起影响也不是很大,而且不是有些人喜欢用事件来画一些地图上的大型或者可动元素比如树木什么的,留着这个副作用的话角色在这些元素后行走也会有半透明效果。
回复

使用道具 举报

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
回帖
403
发表于 2016-1-2 15:53:57 | 显示全部楼层
本帖最后由 夏末渐离 于 2016-1-2 15:55 编辑
andrewx 发表于 2016-1-2 15:04
感谢提供思路~确实可以这样避免平时角色重叠的问题,但是在高层图块后面重叠的话还是会糊在一起囧。其实 ...


在高层图块后面也糊在一起这点不仔细看还真看不出来。
毕竟事件作图,船只什么的跟角色们是处于同一层的所以无法区别对待实施透明化……
看来只能往this._highLayerCharaSprites.z 这项细分了。
  点我进入    
       ↓      
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2016-1-2 17:11:16 | 显示全部楼层
本帖最后由 andrewx 于 2016-1-2 17:16 编辑
夏末渐离 发表于 2016-1-2 15:53
在高层图块后面也糊在一起这点不仔细看还真看不出来。
毕竟事件作图,船只什么的跟角色们是处于同一层的 ...


可以每次都根据事件的x,y去找该处的图块是否包含高层图块,然而这个高层图块的判定系统本身有,只是看图块是否含星形。但我在写墙壁后行走插件时用了自己新写的方法了加入了其他判定,使得A组图块也能被当成高层图块。因此实际上还是不知道图块到底被在绘制的时候被当成了高层还是低层ORZ。。。
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2016-1-2 18:20:10 | 显示全部楼层
本帖最后由 汪汪 于 2016-1-2 18:48 编辑

于是......针对副作用,
把高层元件做出半透明遮挡物就好了,
高层元件在显示时在人物下面,
高层元件的半透明遮挡在人物的上面,
这样人物不需要半透明了.
于是饶了以又绕回来了{:2_276:}


缺点,不能控制单独的事件......
  1. (function() {


  2. Tilemap.prototype._paintTiles = function(startX, startY, x, y) {
  3.     var tableEdgeVirtualId = 10000;
  4.     //现在x = 开始x + x
  5.     var mx = startX + x;
  6.     //现在y = 开始y + y
  7.     var my = startY + y;
  8.     //dx = 现在x * 图块宽(48)  除 层宽(912)的余数  -- 以层宽为基础的 现在图块坐标 x
  9.     var dx = (mx * this._tileWidth).mod(this._layerWidth);
  10.     //dy = 现在y * 图块高(48)  除 层高(720)的余数  -- 以层宽为基础的 现在图块坐标 y
  11.     var dy = (my * this._tileHeight).mod(this._layerHeight);
  12.     //层x
  13.     var lx = dx / this._tileWidth;
  14.     //层y
  15.     var ly = dy / this._tileHeight;
  16.     var tileId0 = this._readMapData(mx, my, 0);
  17.     var tileId1 = this._readMapData(mx, my, 1);
  18.     var tileId2 = this._readMapData(mx, my, 2);
  19.     var tileId3 = this._readMapData(mx, my, 3);
  20.     var shadowBits = this._readMapData(mx, my, 4);
  21.     var upperTileId1 = this._readMapData(mx, my - 1, 1);
  22.     var lowerTiles = [];
  23.     var upperTiles = [];

  24.     if (this._isHigherTile(tileId0)) {
  25.         upperTiles.push(tileId0);
  26.         lowerTiles.push(tileId0);
  27.     } else {
  28.         lowerTiles.push(tileId0);
  29.     }
  30.     if (this._isHigherTile(tileId1)) {
  31.         upperTiles.push(tileId1);
  32.         lowerTiles.push(tileId1);
  33.     } else {
  34.         lowerTiles.push(tileId1);
  35.     }

  36.     lowerTiles.push(-shadowBits);

  37.     if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) {
  38.         if (!Tilemap.isShadowingTile(tileId0)) {
  39.             lowerTiles.push(tableEdgeVirtualId + upperTileId1);
  40.         }
  41.     }

  42.     if (this._isOverpassPosition(mx, my)) {
  43.         upperTiles.push(tileId2);
  44.         upperTiles.push(tileId3);
  45.         lowerTiles.push(tileId3);
  46.         lowerTiles.push(tileId2);
  47.     } else {
  48.         if (this._isHigherTile(tileId2)) {
  49.             upperTiles.push(tileId2);
  50.             lowerTiles.push(tileId2);
  51.         } else {
  52.             lowerTiles.push(tileId2);
  53.         }
  54.         if (this._isHigherTile(tileId3)) {
  55.             upperTiles.push(tileId3);
  56.             lowerTiles.push(tileId3);
  57.         } else {
  58.             lowerTiles.push(tileId3);
  59.         }
  60.     }

  61.     var lastLowerTiles = this._readLastTiles(0, lx, ly);
  62.     if (!lowerTiles.equals(lastLowerTiles) ||
  63.             (Tilemap.isTileA1(tileId0) && this._frameUpdated)) {
  64.         this._lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  65.         for (var i = 0; i < lowerTiles.length; i++) {
  66.             var lowerTileId = lowerTiles[i];
  67.             if (lowerTileId < 0) {
  68.                 this._drawShadow(this._lowerBitmap, shadowBits, dx, dy);
  69.             } else if (lowerTileId >= tableEdgeVirtualId) {
  70.                 this._drawTableEdge(this._lowerBitmap, upperTileId1, dx, dy);
  71.             } else {
  72.                 this._drawTile(this._lowerBitmap, lowerTileId, dx, dy);
  73.             }
  74.         }
  75.         this._writeLastTiles(0, lx, ly, lowerTiles);
  76.     }

  77.     var lastUpperTiles = this._readLastTiles(1, lx, ly);
  78.     if (!upperTiles.equals(lastUpperTiles)) {
  79.         this._upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  80.         for (var j = 0; j < upperTiles.length; j++) {
  81.             this._drawTile(this._upperBitmap, upperTiles[j], dx, dy);
  82.         }
  83.         this._writeLastTiles(1, lx, ly, upperTiles);
  84.     }
  85. };

  86. Tilemap.prototype._createLayers = function() {
  87.         //宽 856
  88.     var width = this._width;
  89.     //高 664
  90.     var height = this._height;
  91.     //页边 20
  92.     var margin = this._margin;
  93.     //图块列  19  大于等于 宽/图块宽 的最小整数 +1  
  94.     var tileCols = Math.ceil(width / this._tileWidth) + 1;
  95.     //图块行  15  大于等于 高/图块高 的最小整数 +1
  96.     var tileRows = Math.ceil(height / this._tileHeight) + 1;
  97.     //层宽 912
  98.     var layerWidth = tileCols * this._tileWidth;
  99.     //层高 720
  100.     var layerHeight = tileRows * this._tileHeight;
  101.     //下层位图
  102.     this._lowerBitmap = new Bitmap(layerWidth, layerHeight);
  103.     //上层位图
  104.     this._upperBitmap = new Bitmap(layerWidth, layerHeight);
  105.     this._layerWidth = layerWidth;
  106.     this._layerHeight = layerHeight;

  107.     /**--------------------------------------------------------------------------
  108.      * Z coordinate:
  109.      * 0 : Lower tiles  较下层图块
  110.      * 1 : Lower characters  较下层人物
  111.      * 3 : Normal characters  正常人物
  112.      * 4 : Upper tiles   较上层图块
  113.      * 5 : Upper characters  较上层人物
  114.      * 6 : Airship shadow  飞艇影子
  115.      * 7 : Balloon      气球
  116.      * 8 : Animation    动画
  117.      * 9 : Destination  目的地
  118.      *--------------------------------------------------------------------------
  119.      */

  120.     //创建下层
  121.     this._lowerLayer = new Sprite();
  122.     //下层移动到 -20,-20
  123.     this._lowerLayer.move(-margin, -margin, width, height);
  124.     //下层z 为0
  125.     this._lowerLayer.z = 0;

  126.     //创建上层
  127.     this._upperLayer = new Sprite();
  128.     //上层移动到 -20,-20
  129.     this._upperLayer.move(-margin, -margin, width, height);
  130.     //上层z 为0
  131.     this._upperLayer.z = 4;

  132.     //添加4个子项精灵到层
  133.     for (var i = 0; i < 4; i++) {
  134.         this._lowerLayer.addChild(new Sprite(this._lowerBitmap));
  135.         this._upperLayer.addChild(new Sprite(this._upperBitmap));
  136.     }
  137.     this._upperLayer.opacity=125//修改透明度在这里.目前没有添加在游戏里修改的方法,不过在 SceneManager_scene往下一级找children应该就能找到它.......我觉得.什么时候出一个children表就好看了.

  138.     //添加下层  
  139.     this.addChild(this._lowerLayer);
  140.     //添加上层
  141.     this.addChild(this._upperLayer);
  142. };
  143. })();
复制代码

点评

注释请无视.............研究地图绘制时乱写的........  发表于 2016-1-2 18:39
回复

使用道具 举报

梦石
0
星屑
55
在线时间
388 小时
注册时间
2009-8-4
回帖
212
 楼主| 发表于 2016-1-2 18:56:01 | 显示全部楼层
汪汪 发表于 2016-1-2 18:20
于是......针对副作用,
把高层元件做出半透明遮挡物就好了,
高层元件在显示时在人物下面,

试了下发现没法跟墙壁后行走插件兼容(必然),
果然是绕回来了,一开始我也想过这么做TvT

点评

瞎糊代码的后果XD  发表于 2016-1-3 21:29
比如英日双语的说明在日版MV就会自动只显示日文说明。然而我们现在用的汉化版都是基于美版的,所以并不能读出标记为/*:zh的中文说明ORZ  发表于 2016-1-2 20:28
哦哦,那就是直接在默认说明里写的中文。本来MV插件管理器是可以根据软件语言直接读取插件中对应版本的说明。  发表于 2016-1-2 20:26
额,直接写到里面......就读取了  发表于 2016-1-2 20:15
咦?是可以直接读取插件里标记为/*:zh的说明吗?  发表于 2016-1-2 20:02
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部