danyburton Posted January 21, 2017 Share Posted January 21, 2017 hello friends, I have been trying to smoothly fade out certain layers of a tilemap, but have not been successful. I can get the tiles to dissapear, but I cannot get them to fade out. Thankyou for any help Link to comment Share on other sites More sharing options...
danyburton Posted January 21, 2017 Author Share Posted January 21, 2017 don't worry, turns out I was trying to set the alpha to like -800 or something Link to comment Share on other sites More sharing options...
danyburton Posted January 21, 2017 Author Share Posted January 21, 2017 function* goSpooky(time) { var totalTime = 0; while (totalTime < time) { totalTime += yield; var alpha = 1 - totalTime / time; if (alpha < 0) alpha = 0; for (var i = 1;i < state.tilemap.layers.length;i++) { state.tilemap.forEach ( function(tile) { tile.alpha = alpha; },this,0,0,state.tilemap.width,state.tilemap.height,i ); state.tilemap.layers[i].dirty = true; } } } here's my code if anyone ever desires it Link to comment Share on other sites More sharing options...
Recommended Posts