m2jalali Posted September 3, 2014 Share Posted September 3, 2014 hii 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 andclick button2 go stage 1how do i do?please guide me Quote Link to comment Share on other sites More sharing options...
hubert Posted September 3, 2014 Share Posted September 3, 2014 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 Quote Link to comment Share on other sites More sharing options...
m2jalali Posted September 3, 2014 Author Share Posted September 3, 2014 Stages as levels of the gameI'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? Quote Link to comment Share on other sites More sharing options...
Sebi Posted September 3, 2014 Share Posted September 3, 2014 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. Deban 1 Quote Link to comment Share on other sites More sharing options...
Larzan Posted October 13, 2014 Share Posted October 13, 2014 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... Quote Link to comment Share on other sites More sharing options...
Larzan Posted October 15, 2014 Share Posted October 15, 2014 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 ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.