Sign in to follow this  
m2jalali

Manage stages

Recommended Posts

hi

i can not know manage my stages.

i create two stage and add sprite image for each stage.

stage1 -> button1 and stage2 -> button 2      (when stage1 invisible and showing stage2 .events in stage1 fire!!!)

i want to click button1 go stage 2 and

click button2 go stage 1

how do i do?

please guide me

Share this post


Link to post
Share on other sites

What do you mean by stages? Stages as levels of the game or stages as a form of the user interface presentation.

 

In case of UI Ezelia already covered it in this article.

 

http://ezelia.com/2013/05/pixi-tutorial/

 

 

 

This is a simple class that I use for the menu elements

_li.define(    'multiverse.views',    function (renderer, loading, main, game) {        'use strict';        var init,            views,            _renderer;        init = function (action, data) {                        if(!_renderer){                                _renderer = renderer();                            }            _renderer.stage.children = [];                        if(action === 'loading'){                views = loading(data);                            }else if(action === 'main'){                                views = main();            }else if(action === 'game'){                                views = game();            }else if(typeof action === 'undefined'){                                return views;            }                        _renderer.renderer.render(_renderer.stage);                        return views;                    };        return init;    },    [        'multiverse.renderer',         'multiverse.views.loading',         'multiverse.views.main',         'multiverse.views.game'    ]);

And this is an example view

_li.define(    'multiverse.views.loading',    function (texture) {        'use strict';        var init,            view = 'loading';        init = function (percent) {                        var options = {                radius: 400,                position: {                                        x: 0,                    y: 0                                    },                dimensions: {                                        height: window.innerHeight,                    width: window.innerWidth                                    },                at: 0,                asset: 'assets/images/screens/loading.png'            };                        texture(options);                        return view;                    };        return init;    },    [        'multiverse.renderer.texture'    ]);

As for levels you should load them dynamically in your game since memory is quite precious especially in mobile environments. 

 

http://www.sevenative.com

Share this post


Link to post
Share on other sites

Stages as levels of the game

I've read several times this tutorial http://ezelia.com/20.../pixi-tutorial/

but when update library ezelia tutorial not working (pixi.dev.js 1.0 ) -> (1.6)

 

" play button " not working when back from game scene !!

Ezelia

"please do not use that tutorial with new pixi version.

 

the tutorial is outdated and do not apply to new version."

 

is there a example with muti level with pixi 1.6?

Share this post


Link to post
Share on other sites

You can use DisplayObjectContainer for that. Just set the visible property to true for the current level and false for all other levels.

But depending on the game, you might not want to permanently store all the objects of your levels in the memory and instead create them when the level is loading.

Share this post


Link to post
Share on other sites

Hi, i am going crazy over the ezelia example mentioned above.

After some research i assumed the problem was simply with the d.ts file i was using and the change from PIXI 1.0 to 1.6.

So i reimplemented the whole example in plain JS, but i got the same problem:

 

If, after rendering Stage A, I switch to render Stage B and then back to Stage A, the mouse callbacks mouseup, touchend, usw. won't trigger anymore for Stage A.

 

It seems that once another Stage is rendering, the previous Stage's callbacks are disabled, but i can't figure out why, especially because after i switch from A to B the A callbacks are still firing, ONLY when i stop rendering Stage B and render Stage A again do they NOT fire anymore, i don't get it. I already wasted so much time on this, but i just can't figure it out :(

 

Any help would be appreciated...

Share this post


Link to post
Share on other sites

ok, i just found this page where they say the same, multiple stages DO NOT WORK correctly yet, they describe the same problem i had with the loosing of interactivity after switching stages.

 

So as the ezelia example is using multiple stages it experiences exactly the problem i found with newer PIXI versions and that was described in the aforementioned link, you loose interactivity.

 

 

Solution

 

only ONE SINGLE STAGE! Use DisplayObjectContainers to group objects.

 

This is not a suggestion, multiple stages DO NOT WORK 100% as of PIXI 1.6 !

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.