Quantcast
Channel: Pixi.js Latest Topics
Viewing all 3980 articles
Browse latest View live

Best way to group sprites for paperdoll?

$
0
0

So I've got some pixel art, in which I've got a base character who is naked, and then I've got items that match the animation of this base character, helmets, bodies, legs, etc. 

I need the items to be over the character z-index wise (I'm using Pixi DisplayGroups currently for z sorting), because obviously we can't sort by Y, or else a helmet would appear under the base sprite for example. So we must put it on a higher layer. The issue then is, if I walk over other sprites (monsters or whatever), since the armor is on a higher layer, the armor will render over their sprites always, while my underneath base sprite is of course Y sorted normally. 

So I need a way to put all the items over the character, but keep it on the same z layer so that it can be y sorted properly.

I was looking at RenderTexture but there doesn't seem to be a way to do it animated?

Do I add all the items to the base sprite as a child? I tried this but it seems the sub items don't move when I move the base sprite position.

Or do I create an entirely new container, and add all the sprites to it, base sprite, items etc. Then set the z-layer of the entirely new container I just created? I did this but when moving the container, the sprites inside it were all offset by a huge huge margin and not actually at the X and Y I was specifying.

 

Thanks :)


Shader translation

$
0
0

Hi, I need help with shaders in pixi . I trying to translate and rotate sprite with shaders. I am using PIXI.Filter but I can find any example with vertex shaders(only fragmet examples :) ). If someone can provide some example . Thanks

DisplayObject.filters questions

$
0
0

I have some questions about filters and how they behave in Pixi.js.

1. When settings filters on a display object like this:

stage.filters = [filter1, filter2, filter3, filter4];

Is the order defined in the list is the same when rendered?

2. Does Pixi.js create brand new FrameBuffer Objects for each filter, or does it reuses the output of the previous filter as input for the next filter?

Sorry if I'm not really clear or accurate since I'm not a WebGL expert ^^

Thanks for your insights :)

Simple Optimization Tips

$
0
0

Hi,

Using the most recent version of PixiJSv4.
I am now using a slow thin client desktop and am seeing performance issues.
Game is running at about 30FPS when it should be 60FPS.

Are there any *simple* optimization tips I can now use to improve performance?
I don't care about the thin client, but am concerned about Google Android smartphones and tablets.
I have a really old Android tablet and am seeing about 15FPS on that device.
(game does run 60FPS on my Samsung Galaxy S7 Edge though)

I would like to target Windows, Linux, and Android.
If someone can point me to a web page about PixiJSv4 optimization I would appreciate it, thanks!

Does Current PixiJSv4 Have Function To Detect Platform?

$
0
0

Hi,

Simple question:
Does current PixiJSv4 have function to detect platform?
(like if game is being played on Wndows, Linux, or Android)

I want to fill entire screen only on mobile Android and not on desktops/notebooks...

Let me know, thanks!

JeZxLee

Working On Input - PixiJSv4 Support Multi-Touch On Mobile?

$
0
0

Hi,

Progress is good, moving now to complete input (both mouse and touch).
Does current PixiJSv4 support any type of multi-finger touch input on mobile devices?

Thanks!

JeZxLee

"InteractionManager"-Get Where Mouse Screen (X, Y)?

$
0
0

Hi,

Looking at the documents, in "InteractionManager" pages.
I can't seem to find house to get mouse screen x, y ?

If I just use mouse functions would that support basic touch input on mobile?

Thanks!

JeZxLee

createShaderPlugin Helper Function

$
0
0

Well I really wanted to be able to setup each shader plugin with just a simple function call so I made this createShaderPlugin function that works like this:

createShaderPlugin(name, vertShader, fragShader, uniformDefaults);

I uploaded the file createShaderPlugin.js to the post if you want to check it out.

I also made this little CodePen to demonstrate the usage with some comments.

The encapsulated code is based on the plugin example and on the worldTransform/vertices calculations that I boosted from PIXI.Sprite:). I have tried to optimize and condense for the use case when the Sprite doesn't have a Texture and tried to make it easy to use and behave expectedly... But please let me know if you find improvements/mishaps or have questions about it  :)


Need Someone To Test On Apple Safari(Mac OS X/iOS)?

$
0
0

Hi,

While I don't officially support Apple(R), I am curious if the current build of the engine works on their hardware.
Was hoping someone here with both a Mac OS X computer and iOS mobile device could just quickly test on them?

The URL link to the demo is HERE.

- On Mac OS X Safari I just need to know if browser resizing/centering is working?
- On iOS Safari smartphones and tablets I just need to know if game fills entire screen and survives screen orientation changes?

I've tested the build on:
- Microsoft(R) Windows(R) 10 Pro 64Bit Edge, Firefox, Chrome, Opera
- Linux Mint 18.2 KDE 64Bit Firefox, Chrome
- Samsung Galaxy S7 Edge ( 60FPS :) )

Incredible WebGL 2-D video game engine!

JeZxLee

Do I Have To Specify Image Sizes In *.JSON File?

$
0
0

Hi.

Working on PNG image sprite core today.
I looked at the demo's *.JSON file and see that is has image sizes.
Must I specify image sizes in the *.JSON file?

"blob.png":
{
	"frame": {"x":55,"y":2,"w":32,"h":24},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":32,"h":24},
	"sourceSize": {"w":32,"h":24},
	"pivot": {"x":0.5,"y":0.5}
},

(my game would have 100's of images and the above would be cumbersome.

Let me know, Thanks!

JeZxLee

How to use vertex shader with Pixi.js?

$
0
0

Hi,

While I'm studying WebGL, I'm wondering how to use vertex shader with Pixi.js. Using fragment shaders is quite clear in my mind, but I'm still confused on how to send vertices coordinates to a vertex shader in Pixi.js.

For instance, assuming we have such a vertex shader:

// vertex shader
attribute vec3 aVertexPosition;

uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;

void main(void) {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
}

and we have such vertices coordinates:

const vertices = [
     0.0,  1.0,  0.0,
    -1.0, -1.0,  0.0,
     1.0, -1.0,  0.0
];

How could I draw this triangle (this is supposed to be a triangle) with this vertex shader and Pixi.js?

Thanks! :)

Have you used TravisoJs or know of any games that use it?

Unable To Load/Display Sprites From Different JSON File?

$
0
0

Hi,

I modified the demo I was using to use a new texture JSON I made.
When I run the game now, just the text shows and no sprites?
There are no errors in browser console.
You can download the entire project HERE (code is clean).

Hope someone can figure out what is wrong with above code?
Thanks!

JeZxLee

Arrays Of Clickable Button Sprites Not Working?

$
0
0

Hi,

Can someone look at my code HERE. (source code is clean)

I've got 6 on screen clickable button sprites but they do not function?
There are no errors in browser console.
Demo can be played HERE.

Thanks!

JeZxLee

Render finish event or Sheder finish event

$
0
0

Is there a way to call specific function or event when render finishing with rendering  specific sprite or event when shader is executed ?


Can I Advertise PixiJSv4 In My Game?

$
0
0

Hi,

I added a PixiJSv4 logo on the title screen HERE.
If it is not allowed just let me know and I will remove it.
Kick ass WebGL engine - it's the best of its kind!

JeZxLee

Check If Pixi Sprite Exists?

$
0
0

Hi,

I need a method to check if a Pixi sprite exists.
For example I have a "FloppyDisk" sprite which is shown on title screen but not previous screen.
I need a method to check if Pixi sprite called "FloppyDisk" has been loaded.

Thanks!

JeZxLee

How To Disable Pixi Sprite Smoothing?

$
0
0

Hi.

How would I disable Pixi sprite smoothing?
Thanks!

JeZxLee

Problem referencing correct texture in atlas

$
0
0

I'm pretty new to JS so I apologize for the messy code. Also don't hold back on telling me what I should and shouldn't do design wise! The problem is that way at the bottom where the for loop is, it is not referencing the textures I want as declared in the variables head and body early on. But when I test it out in about line 16 or so, it does reference the correct texture.Thanks for reading

 

class Player {
    constructor(dataObj) { //
        this.uid = dataObj.username;
        this.sprite = dataObj.sprite || "default";
        this.x = dataObj.x || 0;
        this.y = dataObj.y || 0;
        this.width = 32;
        this.height = 32;
        this.PIXISPRITE;
        this.testSprite;
        if (dataObj.sprite.custom === false) {
            let spriteTextures = [];
            let head = loaderSource["/client/img/custom_head.json"].textures[this.sprite.layer1 + ".png"];
            let body = loaderSource["/client/img/custom_body.json"].textures[this.sprite.layer2 + ".png"];
            spriteTextures.push(head, body);
            console.log(head);
            this.testSprite = new PIXI.Sprite(head); 
/*when I test this, it grabs the texture from atlas just fine. */

            let createArrComponents = (paraSpriteText) => {
                let arrayTextures = [];
                let counterX = 0;
                let counterY = 0;
                for (let i = 0; i < paraSpriteText.length; i++) {
                    let tmpArray = [];
                    let indexspriteTextures = i;
                    const ROWS = paraSpriteText[i].width / this.width;
                    const COLUMS = paraSpriteText[i].height / this.height;
                    for (let i = 0; i < ROWS * COLUMS; i++) {
                        let rectFrameObj = new PIXI.Rectangle(counterX, counterY, this.width, this.height);
                        counterX += this.width;
                        let framedTexture = new PIXI.Texture(paraSpriteText[indexspriteTextures]);
                        framedTexture.frame = rectFrameObj;
                        tmpArray.push(framedTexture);
                        if (counterX >= this.width * ROWS) {
                            counterX = 0;
                            counterY += this.height;
                        }
                    }
                    arrayTextures.push(tmpArray);
                }
                return arrayTextures;
            };
            let spriteComponentsArr = createArrComponents(spriteTextures);
            console.log(spriteComponentsArr);
            for (let i = 0; i < spriteComponentsArr.length; i++) {
                let headSprite = new PIXI.extras.AnimatedSprite(spriteComponentsArr[0]);
/*THESE TWO ARE NOT REFFERENCING THE TEXTURE I WANT AS DECLARED IN THE VARIABLES head & body */
                this.PIXISPRITE = headSprite;
                headSprite.addChild(new PIXI.extras.AnimatedSprite(spriteComponentsArr[1])); //ADDSSTHEBODY
            }
        }
        Player.list[this.uid] = this;
    }
    createSelfSprite() {
    }
}

let test = new Player({username: "testy", 
sprite: {layer1: "head_no1",
          layer2: "body_no6"}
});

 

Does PixiJSv4 Have Canvas Change Transitions?

$
0
0

Hi,

Started working on the various game screens.
Does PixiJSv4 have any type of canvas transitions?
Like if I want to fade to black one screen and then fade from black to another screen?

Let me know, thanks!

JeZxLee

Viewing all 3980 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>