diff --git a/src/jsds_crafty.js b/src/jsds_crafty.js index d003681..d2b595c 100644 --- a/src/jsds_crafty.js +++ b/src/jsds_crafty.js @@ -104,7 +104,6 @@ cur_sel.sel_bon(); } else { - console.log("Hide UIBON"); $('#uibon').hide(); } cur_sel.printoutput(); @@ -124,6 +123,9 @@ cur_sel.printoutput(); } }); + this.bind('KeyUp', function(e) { + cur_sel.printoutput(); + }); return this; }, @@ -151,10 +153,24 @@ /* At the end, disable mouse-control for all creatures */ + var focused = false; + var last_sel; var end_init = function() { Crafty("Creature").each( function() { this.disableControl(); }); + $(window).focus( function() { + last_sel = cur_sel; + }); + }; + + var reset_bug = function() { + Crafty("Thing").each( function() { + this._movement.x=0; + this._movement.y=0; + }); + var g= last_sel.graphelement; + g.attr("x",g.old_pos.x); + g.attr("y", g.old_pos.y); }; - }