Problems with AnimationSheet
Hi
Testing the lastest version 0.9.7 with changes made in ticket #15, I detected some issues:
- Using setCurrentAnimation with Callback function, drop some errors. The code this.renderable.setCurrentAnimation("start", "end"); is OK.
But the code this.renderable.setCurrentAnimation("start", function(){this.renderable.setCurrentAnimation("end"); this.status = "OK";});
Show the error "Uncaught TypeError: Cannot call method 'setCurrentAnimation' of undefined."
In the 0.9.6 the code above works and comparing the two versions, in the 0.9.7 has removed the this.parent(); in the line 581 of sprite.js file.
- Enabling me.sys.dirtyRegion the console shows the error "Uncaught TypeError: Cannot call method 'clone' of null melonJS-0.9.7.js:3471" when calling me.game.remove(this);
I will be testing in the next days the support for JSON map formats as ticket #140 ;)
Thanks!
Hi,
about this.renderable.setCurrentAnimation("start", function(){this.renderable.setCurrentAnimation("end"); this.status = "OK";});
I had the same issue, and this is due to the context to this being lost when the callback is called
if you change it to the following, then it should work again :
var self = this;
this.renderable.setCurrentAnimation("start", function(){self.renderable.setCurrentAnimation("end"); self.status = "OK";});
note that bind could be use as well, doing something like (untested):
this.(function(){self.renderable.setCurrentAnimation("end"); self.status = "OK";}).bind(this);
and I forgot, but thank you very much for testing :)
Hi Olivier
With the code above (var self = this....) it's worked. But this is the right behavior? This is done by the change in the ObjectEntity?
And the second problem, when enabling me.sys.dirtyRegion, any idea? Disabling this option the error is not show in the log.
Thanks for your dedication and for the well done job!
@ciangames
For the first one I would rather say (if i'm not wrong) that the previous behavior was not really good, as using this in a callback function is mostly a guarantee that this will be the wrong once when the callback will be fired.
for the second one, sorry I did not look at it yet, I was busy yesterday working on the Texture Packer stuff and did not take the time to do any debugging :( but from the top of my head i'd say that this is maybe due to the getRect() function in Object Entity not doing what she should do, i'll see to fix that asap.
are you actually using dirtyRect in Vibrant Recycling ?
you're welcome and thank you again for doing a beta-tester !
Hi Olivier
Thanks for the clarification abot the first "issue" :)
And about the second, yes, I use the dirty region in Vibrant Recycling because the Tiled levels in the game are static ;)
I tested also the me.sys.useNativeAnimFrame = true; and noticed an improvement in FPS. The old version has a bug, decreasing the FPS when activate it!
I thank you for your dedication, the least I can do is testing :)
Thanks again!
@ciangames
the second bug should be fixed now. I used the dirtyRect example to reproduce it and with this fix, no more exception ! if you could give it another shot to confirm, that would be great :)
Hi Olivier
Works like a charm!
Thanks again!