Drawing image into specific layer? [solved]

Status
Not open for further replies.
Joined
Jun 30, 2017
Messages
42
Reaction score
35
First Language
spanish
Primarily Uses
RMMV
Hi, I am trying to draw a image into the screen, with PIXI.
Currently using:

Code:
var img = PIXI.Sprite.fromImage('./img/pictures/logo.png');
SceneManager._scene.addChild(img);
That works, but the image is on the top layer, and I need to draw the image on the 'floor' layer, between tileset <-> events.
Maybe some container for each layer exists?

Thanks
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yes, there is.

Spriteset_Map has a _baseSprite property that holds the tilemap, and the tilemap holds both the tiles and the characters.

Something like this might get you somewhere:

SceneManager._scene._spriteset._tilemap.addChildAt(img, x)

where x is 1, 2, 3, etc - just experiment until you get the right place.
 
Joined
Jun 30, 2017
Messages
42
Reaction score
35
First Language
spanish
Primarily Uses
RMMV
Thanks @Shaz for pointing me into the right direction, that seems to work but there are some strange Z position issues, sometimes the images change their z position while the character is moving, so instead of directly addiing images i used two containers with diferent z positions.

Code:
            // BOTTOM LAYER
            BlackLights.layer.bottom = new PIXI.Container();
            var map_width = ($gameMap.width() * $gameMap.tileWidth());
            var map_height = ($gameMap.height() * $gameMap.tileHeight());
            BlackLights.layer.bottom.width = map_width;
            BlackLights.layer.bottom.height = map_height;
            SceneManager._scene._spriteset._tilemap.addChild( BlackLights.layer.bottom );
            BlackLights.layer.bottom.z = 3;

            // TOP LAYER
            BlackLights.layer.top = new PIXI.Container();
            var map_width = ($gameMap.width() * $gameMap.tileWidth());
            var map_height = ($gameMap.height() * $gameMap.tileHeight());
            BlackLights.layer.top.width = map_width;
            BlackLights.layer.top.height = map_height;
            SceneManager._scene._spriteset._tilemap.addChild( BlackLights.layer.top );
            BlackLights.layer.top.z = 45;
Then i add the images as children's of one of the containers.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,829
Reaction score
5,221
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top