android - Same constant sprite for all Scenes in AndEngine -


my goal make 2 buttons constant scenes, how should (in example of browser game): enter image description here

enter image description here

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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -