Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with AnimationSheet #171

Closed
aaschmitz opened this issue Mar 12, 2013 · 7 comments
Closed

Problems with AnimationSheet #171

aaschmitz opened this issue Mar 12, 2013 · 7 comments
Milestone

Comments

@aaschmitz
Copy link
Contributor

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!

@melonjs
Copy link
Collaborator

melonjs commented Mar 12, 2013

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);

@melonjs
Copy link
Collaborator

melonjs commented Mar 12, 2013

and I forgot, but thank you very much for testing :)

@aaschmitz
Copy link
Contributor Author

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!

@melonjs
Copy link
Collaborator

melonjs commented Mar 13, 2013

@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 !

@aaschmitz
Copy link
Contributor Author

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!

@melonjs
Copy link
Collaborator

melonjs commented Mar 13, 2013

@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 :)

@aaschmitz
Copy link
Contributor Author

Hi Olivier

Works like a charm!

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant