We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I try to figure how to use some spritesheet ( like https://jb3.devnewton.fr/pasted/2da929eb-8783-4162-87a2-80ac4350ab81.jpg ).
Is it possible to define the atlas manually? Melonjs documentation only talk about Texture Packer or Shoebox.
I tried this:
let atlas = { "meta": { "app": "melonJS", "size": {"w": 512, "h": 512}, "repeat": "no-repeat", "image": "sara" }, "frames": [{ "filename": "stand", "frame": {"x": 1, "y": 1, "w": 32, "h": 48} }] }; let texture = new me.video.renderer.Texture( atlas, me.loader.getImage("sara") ); this.renderable = new me.Sprite(0, 0, {image: texture}); this.renderable.addAnimation("stand", [{ name: "stand", delay: Infinity }]); this.setCurrentAnimation("stand");
But it is not detected as an atlas:
string parameters for addAnimation are not allowed for standard spritesheet based Texture
The text was updated successfully, but these errors were encountered:
when creating sprite out of atlas, you should rather use the "createAnimationFromName" helper function : http://melonjs.github.io/melonJS/docs/me.Renderer.Texture.html#.createAnimationFromName
so you should change the renderable definition to :
this.renderable = texture.createAnimationFromName(["stand"]); this.renderable.addAnimation("stand", [{ name: "stand", delay: Infinity }]); this.renderable.setCurrentAnimation("stand");
(also, be careful, you call setCurrentAnimation on this object instead of the renderable)
setCurrentAnimation
this
this should helpfully work now :P
Sorry, something went wrong.
No branches or pull requests
I try to figure how to use some spritesheet ( like https://jb3.devnewton.fr/pasted/2da929eb-8783-4162-87a2-80ac4350ab81.jpg ).
Is it possible to define the atlas manually? Melonjs documentation only talk about Texture Packer or Shoebox.
I tried this:
But it is not detected as an atlas:
The text was updated successfully, but these errors were encountered: