snippet in design mode
Preview code in design mode
actor.setFilter([]);
computational shortcuts require
import flash.filters.BitmapFilter
import com.stencyl.utils.ColorMatrix.
computatinal shortcut 1 - showing another opportunity to optimise for format-specific code.
#if (!use_actor_tilemap && !flash)
if(bitmapFilters == null)
bitmapFilters = [];
bitmapFilters = bitmapFilters.concat(filter);
if(currAnimation != null) currAnimation.filter = bitmapFilters;
#else
filters = filters.concat(filter);
#end
computational short 2 for JavaScritpt-HTML5 format.
if(bitmapFilters == null)
bitmapFilters = [];
bitmapFilters = bitmapFilters.concat(filter);
if(currAnimation != null) currAnimation.filter = bitmapFilters;
Since thism is the list, the bitmatfilters can be edited indibidually.
For example:
Player_ngs.head_redpwr = Std.int(mpx/this.w*256);
var bf: ColorMatrix = new ColorMatrix();
bf.colorize(Player_ngs.head_redpwr*65536 + Player_ngs.head_grepwr * 256 + Player_ngs.head_blupwr,1);
if(S_ngs_bodypart_behav.head.bitmapFilters == null || ""+S_ngs_bodypart_behav.head.bitmapFilters == "undefined") {S_ngs_bodypart_behav.head.bitmapFilters = [];}
S_ngs_bodypart_behav.head.bitmapFilters[0] = bf.getFilter();
S_ngs_bodypart_behav.head.currAnimation.filter = S_ngs_bodypart_behav.head.bitmapFilters;
Where:
mpx isouse posotion relative to the actor;
this.w is the width oif the actor
Player_ngs is a code freeform mode with only public static vars and nom constructors.
No comments:
Post a Comment