android - Same constant sprite for all Scenes in AndEngine -
my goal make 2 buttons constant scenes, how should (in example of browser game):
in order achieve goal had add them in basescene
:
private void populatewithoptionsbuttons() { audiocontroltexture audiocontroltexture = new audiocontroltexture(); audiocontroltexture.setpositiony(engine.getuihelper().getdeviceheight() - 50); buttonsprite audiocontrolbutton = engine.getspriteloader(). loadstaticbuttonspritefromname( audiocontroltexture.getname(), audiocontroltexture.getwidth(), audiocontroltexture.getheight(), audiocontroltexture.getpositionx(), audiocontroltexture.getpositiony() ); makescreenshottexture makescreenshottexture = new makescreenshottexture(); makescreenshottexture.setpositiony(engine.getuihelper().getdeviceheight() - 50); buttonsprite makescreenshotbutton = engine.getspriteloader(). loadstaticbuttonspritefromname( makescreenshottexture.getname(), makescreenshottexture.getwidth(), makescreenshottexture.getheight(), makescreenshottexture.getpositionx(), makescreenshottexture.getpositiony() ); this.attachchild(audiocontrolbutton); this.attachchild(makescreenshotbutton); }
but bad thing created each scene, goal : create them once use in scenes. help
create hud populatewithoptionsbuttons() logic in "basescene" , attach basescene. scenes extend basescene have hud.
Comments
Post a Comment