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

Spritesheet animation question #10

Closed
wiggleMyEars opened this issue Jun 13, 2017 · 4 comments
Closed

Spritesheet animation question #10

wiggleMyEars opened this issue Jun 13, 2017 · 4 comments

Comments

@wiggleMyEars
Copy link

Dear Dan,

Thank you for making this incredible library and its excellent documentation!

I think I'm getting something wrong here... zim_4.1.1.js seems to run the spritesheet animation without any problems, but zim_5.2.2 seems to have problem finding the canvas, it throws up a getContext error. I am sure this is my lack of experience with js.

Thank you for this wonderful resource!

Jim

@danzen
Copy link
Owner

danzen commented Jun 17, 2017

Hi Jim - sorry for the delay getting back - just noticed this. Assuming you have a CreateJS SpriteSheet and were passing that in as a the first parameter to the ZIM Sprite(). You should be able to fix this as follows:

new zim.Sprite({spriteSheet:spriteSheet});

As of 4.7.0 there was a change to the Sprite to make the CreateJS SpriteSheet internally. So the Sprite() parameters have changed. The Documentation has an "updates" link http://zimjs.com/code/updates.html which has the following under 4.7.0:

Sprite has json parameter which replaces spriteSheet parameter BREAK
The SpriteSheet is now made internally from the json
can still pass in rows and cols as well instead of json
Note that the BREAK - means old code might break. Then in 5.2.0 we added the spriteSheet parameter back in (in a different place at the very end) as CreateJS came out with dynamic SpriteSheet building with SpriteSheetBuilder!

So, sorry for the run around - I hope that is the issue - just check the recent Sprite() parameters in the docs at http://zimjs.com/code/docs.html?id=sprite Note that you may not need to make the CreateJS SpriteSheet as you can now just pass in the JSON information for that SpriteSheet and the ZIM Sprite will make the SpriteSheet for you ;-). See the http://zimjs.com/code/spritesheet example. I will update the ZIM Bits that have older SpriteSheet examples...

@danzen
Copy link
Owner

danzen commented Jun 17, 2017

I have updated the two ZIM Bits that dealt with Sprites to the new way ;-)
http://zimjs.com/code/bits/view/scrub.html
http://zimjs.com/code/bits/view/explosion.html
Thanks, Jim, for using ZIM - all the best... let me know if that works for you.

@wiggleMyEars
Copy link
Author

Thank you Dan!
Works a treat. I knew it would be something I'd missed. Sorry to have bothered you when it was in the updates documentation.
Thank you for your help and for a wonderful resource
Jim

@danzen
Copy link
Owner

danzen commented Aug 31, 2017

Hi Jim - not sure how to reach you - but come on in the ZIM Slack Group if you want - here is an invite
https://join.slack.com/t/zimjs/shared_invite/MjMwNDM0MDkzOTg1LTE1MDM1NDIxNDktNGRlMzBjMjRiYQ

Not sure if you have been keeping up with ZIM – but lots of updates over the summer – see the 30 or so Bubbling videos and there is a new site – we are on ZIM Six now!

Dan

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

2 participants