查看: 2494|回复: 0

[已经解决] bitmap的颜色混入问题

[复制链接]
梦石
0
星屑
50
在线时间
1281 小时
注册时间
2006-8-27
回帖
550
发表于 2016-4-8 05:38:38 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 wbsy8241 于 2016-4-8 15:11 编辑
  1. var Ccc = Ccc || {};

  2. Ccc.Sprite_Enemy_initMembers = Sprite_Enemy.prototype.initMembers
  3. Sprite_Enemy.prototype.initMembers = function() {
  4.     Ccc.Sprite_Enemy_initMembers.call(this);
  5.     this.createShadowSprite();
  6. };

  7. Sprite_Enemy.prototype.createShadowSprite = function() {
  8.     this._shadowSprite = new Sprite();
  9.     this._shadowSprite.anchor.x = 0.5;//ox
  10.     this._shadowSprite.anchor.y = 1;//oy
  11.     this._shadowSprite.y = 0;
  12.     this.addChild(this._shadowSprite);
  13. };

  14. Sprite_Enemy.prototype.refresh = function() {
  15.     this._shadowSprite.bitmap = new Bitmap(this.bitmap.width, this.bitmap.height);
  16.     this._shadowSprite.bitmap.blt(this.bitmap,0,0,this.bitmap.width,this.bitmap.height,-10,0,this.bitmap.width,this.bitmap.height);
  17.     this._shadowSprite.bitmap.blt(this.bitmap,0,0,this.bitmap.width,this.bitmap.height,10,0,this.bitmap.width,this.bitmap.height);
  18.     this._shadowSprite.bitmap.blt(this.bitmap,0,0,this.bitmap.width,this.bitmap.height,0,-10,this.bitmap.width,this.bitmap.height);
  19.     this._shadowSprite.bitmap.blt(this.bitmap,0,0,this.bitmap.width,this.bitmap.height,0,10,this.bitmap.width,this.bitmap.height);
  20.     this._shadowSprite.setBlendColor([0, 255, 255, 0]);
  21. };

  22. Sprite_Enemy.prototype.update = function() {
  23.     Sprite_Battler.prototype.update.call(this);
  24.     if (this._enemy) {
  25.         this.updateEffect();
  26.         this.updateStateSprite();
  27.         if (this.bitmap.width > 0) {
  28.             this.refresh();
  29.         }
  30.     }
  31. };
复制代码


==》 this._shadowSprite.setBlendColor([0, 255, 255, 0]);

请问我混入颜色 透明度是0的时候图片还是在的
但是选1-255 整个图片就消失了 这是为什么?


回:refresh 执行一次就可以正常显示 真实奇怪的设定
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部