Jump to content

Spritesheet problems


Menakatep
 Share

Recommended Posts

So, I've been struggling to get spritesheets to work in PIXI. I've got everything hosted on a webserver and have followed the instructions on the documentation for the new way with V5. Its not working and I'm not quite sure where I'm going wrong.

PIXI.Loader.shared.add("images/floortiles.json").load(gameStart);
            function gameStart() {
                let sheet = PIXI.Loader.shared.resources["images/floortiles.json"].spritesheet; 
                stage = new PIXI.Container();
                renderer = PIXI.autoDetectRenderer(
                    800,
                    600,
                    {view:document.getElementById("game-canvas")}
                );
}

 

Now, I'm not sure the best way to go about using the Sprites as I'm still learning; however, I've got something that should load the correct frame from the sheet.
grasstile = new PIXI.Sprite(sheet.textures['tile_2.png']);
That being said, all of this was successful with separate image files. I just haven't been able to make use of the spritesheet functionality. I would GREATLY appreciate any insight you guys can provide. Thanks!
Link to comment
Share on other sites

and have followed the instructions on the documentation for the new way with V5

Where did you see those docs? According to https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#renderer-parameters aoptions should be the only param, "800,600" shouldn't be separate. Give me a link please, I'll fix them :)

 

Your code looks fine. If moving renderer size to options dosnt help, well, I suggest you to use chrome devtools to debug- look in the console, place a breakpoint, e.t.c. . If you dont see anything strange - you can post a demo and people will look at it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...