Jump to content

Sam
 Share

Recommended Posts

Could not find a similar post on this, I just want to push some sprites into a group.
If I do so, they are not visible anymore. When I do not set the group they are still visible.

Here is my code.

 

 ....  game.state.start('Title');    }}var stateTitle = {    preload: function(){        this.load.image( 'uiPlayBTNouter', 'assets/@1x/ui_play-btn_outer.png' );        this.load.image( 'uiPlayBTNinner', 'assets/@1x/ui_play-btn_inner.png' );        this.load.image( 'uiPlayBTNdir', 'assets/@1x/ui_play-btn_dir.png' );        this.load.audio( 'BGMtitlescreen', 'assets/audio/bgm_titlescreen.mp3' );    },    create: function(){        console.log( "game started" );        var bg = game.stage.backgroundColor = '#040f1b';        this.BGMtitlescreen = game.add.audio( 'BGMtitlescreen' );        this.BGMtitlescreen.play( '', 0, 1, true);                this.uiPlayBTN = game.add.group();        this.uiPlayBTNinner = game.add.sprite( game.width / 2, game.height -200 * pixelratio, 'uiPlayBTNinner' );        this.uiPlayBTNouter = game.add.sprite( game.width / 2, game.height -200 * pixelratio, 'uiPlayBTNouter' );        this.uiPlayBTNdir = game.add.sprite( game.width / 2, game.height -200 * pixelratio, 'uiPlayBTNdir' );        this.uiPlayBTN.add(this.uiPlayBTNinner);        this.uiPlayBTN.add(this.uiPlayBTNouter);        this.uiPlayBTN.add(this.uiPlayBTNdir);        this.uiPlayBTN.setAll('anchor',0.5);        this.uiPlayBTN.x = game.width / 2;        this.uiPlayBTN.y = game.height -200;    },    update: function(){            }}...

 

Link to comment
Share on other sites

found by myself.

setAll of 'anchor' - does cause it and:
setting x & y of the group replaces it relatively, the children in it respond absolute positioned to this, so they were out of screen ~closed.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...