nio_kasgami

how to make Pixi.Spritesheet compatible with Rpg maker mz

Recommended Posts

Hi, 

I love a lots the implementation of Spritesheet since it work like atlas and for UI it's wonderful to use or any project who has a lots of Sprites. 

Although the way that MZ or rpg maker implements sprite seem to be a puzzle I can seem to figure out to implement Spritesheet. 

Here's the SPrite API source code 

https://developer.rpgmakerweb.com/rpg-maker-mz/Sprite.js.html#line9 

It seem to be working through Bitmap (which is common with RM) instance instead of a direct texture so figuring out how to implement it 

here's the Bitmap class API source code 

https://developer.rpgmakerweb.com/rpg-maker-mz/Bitmap.js.html#line9

 

My guess was to go and Set the base texture / image to point towards the Spritesheet but I am unsure if it would not work? my guess would be also to create an instance of Spritesheet inside the bitmap class but it seem that would actually cause a memory leak (creating instance duplicates) 

so I am kinda at lost there? 

 

 

Share this post


Link to post
Share on other sites

I see well that's the thing 

they didn't rewrite much and didn't inputed that. 

I will do some test  so if I understand what u say

the code should look like this


var spritesheet = SpriteSheet["MySprite"]; // Let's assume it was loaded before hand

var sprite = new Sprite();

sprite.bitmap.basetexture = spritesheet.basetexture;
sprite.texture = spritesheet.texture;
sprite._frame = spritesheet.frame;

I aint sure ill try to write an Atlas wrapper so it automatically setup those things. but yeah if I understand correctly it's how you would approach it? 

Edited by nio_kasgami

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.