Jump to content

Create multiple sprites from one texture


Recommended Posts


I am making a platformer game with pixijs. I am creating the platforms with a container and multiple sprites, but it is messy and inconvient for me to create a sprite for every block of the platform.

Here is what I am doing now:

var platform = new Container();

crate1 = new Sprite(resources.tiles.textures["boxCrate.png"]);
crate1.position.set(0, 0);

crate2 = new Sprite(resources.tiles.textures["boxCrate.png"]);
crate2.position.set(1 * 128, 0);

crate3 = new Sprite(resources.tiles.textures["boxCrate.png"]);
crate3.position.set(2 * 128, 0);

crate4 = new Sprite(resources.tiles.textures["boxCrate.png"]);
crate4.position.set(3 * 128, 0);


Hopefully you get what I mean... anyway to speed this up?

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.

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.


  • Recently Browsing   0 members

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