2013-05-07 94 views
0

我正在制作一个游戏,用户必须在用户点击时创建的颜色图形创建一个形状。它适用于大多数颜色,但是当两个橙色或紫色splat叠加时,会产生奇怪的颜色混合。你可以看到这个链接上的问题http://img812.imageshack.us/img812/1497/screenshot20130507at114.pngAS3颜色叠加

我使用创建层片的代码是:

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); 

回答