javascript - Having trouble clearing canvas element -
the problem i'm having lines not clearing canvas. not quite sure why. i've looked issue quite awhile. here's of code:
function handles creation of line segments
var ui= { clear:function() { gsx.clearrect(0,0,window.gsw,window.gsh); }, drawcharacterrays:function() { for(z=0;z<walljoints.length;z++) { originx=(gsw/2); originy=(gsh/2); gsx.strokestyle='#ff0000'; gsx.beginpath(); gsx.moveto(originx,originy); gsx.lineto(walljoints[z][0],walljoints[z][1]); gsx.closepath(); gsx.stroke(); } } }
and code show order @ functions called:
function engine() { ui.clear(); gsx.fillstyle="#ffffff"; gsx.fillrect((gsw-characterw)-window.x,(gsh-characterh)-window.y,mapw,maph); ui.drawmap(curlevel, [1,1,0,0,0,0,0,1,0,1], [1,1,0,0,0,0,0,1,0,1]); ui.drawcharacterrays(); ui.drawcharacter(); ui.drawstaminabar(); ui.drawhealthbar(); }
i'd happy drop more code if needed, warned... there's lot...
saved myself time , made functional version in fiddle here : http://jsfiddle.net/cav63
Comments
Post a Comment