html5 - Using createjs, preoloading and caching, why is my canvas still so slow? -


I'm trying to create a small RPG for the square I create a bitmap image, I cache it, and Then every time I need the same bitmap, I clone it, and finally add them to the stage. However, despite my efforts, my canvas is still very slow because I am portraying all these shrubs.

I will put them in the container, however, I need to know the position of X and Y as the way I know that the player is trying to step on its borders.

Here's my job:

  Parsum: function (map object, room, obje, image) {var letter = 'X'; // var object = ob; Var object = null; Var img = new creates.bitmap (image); (Var m = 0; m & lt; mapObject.length; m ++) {for (var j = 0; j & lt; map object [m]. Length; j ++) {letter = mapObject [j] [ I]; Switch (letter) {case 'X': // nothing break; Case 'O': // object = this.createObject (); //object.image = img.clone (); Img.cache (); Object = img.clone (); Cell.Adobstakal (object, M, J); break; }}}}  

And this is my job when I actually add them to the forum:

  addObstacle: function (imgObj, x, y) {ImgObj.x = x || ImgObj.x || 0; ImgObj.y = y || ImgObj.y || 0; ImgObj.setVisible = Tasks (visible) {this.visible = visible; }; ImgObj.update = function () {if (this.visible) this.visible = true; And this. Visible = false; }; Objects.push (imgObj); Stage.addChild (imgObj); },  

As you can see, I increase the bitmap class and additionally add and update and set a viable method on it. In this way I can depend on the screen or turn them off. Any idea which can help me and make my game smoother? Thanks!

my canvas map

I was constantly updating everything including bushes, and bushes had no need to update every tick. I simply removed the argument by checking the bushes and now it actually runs fast.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -