AS3色彩叠加

时间:2013-05-07 17:08:46

标签: actionscript-3 actionscript

我正在开发一款游戏,用户必须使用在用户点击时创建的颜色splat绘制一个形状。它适用于大多数颜色,但当两个橙色或紫色splat叠加时,会产生奇怪的颜色混合。您可以在此链接http://img812.imageshack.us/img812/1497/screenshot20130507at114.png

上看到问题

我用来创建splats的代码是:

var the_color:uint;

        var splat = new splat_wrap;
        splat.rotation = (Math.random() * 360);
        var rand=Math.ceil(Math.random() * 2);
        splat.gotoAndStop(rand)
        splat.x=msx;
        splat.y=msy;
        this.splatMc.addChild(splat);


        if(this.color=='red')the_color=0xFF0000;
        else if(this.color=='yellow') the_color=0xFFFF00;
        else if(this.color=='blue') the_color=0x0000FF;
        else if(this.color=='green') the_color=0x00FF00;
        else if(this.color=='pink') the_color=0xFF00FF;
        else if(this.color=='black') the_color=0x000000;
        else if(this.color=='purple') the_color=0xCC3399;
        else if(this.color=='orange') the_color=0xFF8000;
        else the_color=0x00FF00;

        var ct:ColorTransform = new ColorTransform();
        ct.color=the_color;


        mat.identity();
        mat.rotate(splat.rotation/180*Math.PI)
        mat.translate(splat.x, splat.y)
        bmd.draw(splat,mat,ct, "add")

        this.splatMc.removeChild(splat);

1 个答案:

答案 0 :(得分:0)

尝试将第二行最后一行中的blendMode“add”更改为以下混合模式之一(请参阅suheading'Public Constants'....“layer”或“alpha”的模式可能就是你的'正在寻找)http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BlendMode.html