Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
Get the sprite position data and pass to next scene

IS that possible to get the sprite position data and pass it to next scene?

Scene 1

    preload() {
        this.load.image('neutral_emoji', '/image/neutral.png');
        this.load.image('sad_emoji', '/image/sad.png');
        this.load.image('happy_emoji', '/image/smiley.png');
    }

    create() {
        var emoji = ['sad_emoji', 'happy_emoji'];
        this.neutral = this.add.image(0, 0, 'neutral_emoji');
        this.emotion = this.add.image(0, 0, emoji[Math.floor(Math.random() * emoji.length)]);
        this.aGrid = new AlignGrid({scene: this,rows: 11,cols: 11});
        this.aGrid.placeAtIndex(57,this.neutral);
        this.aGrid.placeAtIndex(63,this.emotion);
        Align.scaleToGameW(this.neutral,.1);
        Align.scaleToGameW(this.emotion,.1);
     }

As the code above the neutral emoji is placed at position 57 and sad/smiley is placed at 63.I would like to pass the position data and texture key to Scene 2

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Depending how you are starting the next scene, but yes, just can pass the data you want to pass, to the next scene as parameter

// first Scene 'data' to pass
this.scene.start('NextScene', {key:'texure_key', x: 1, y: 1});

This parameter will be passed to the function calls of methods init and create, so you can retrieve the data from that parameter.

// Next Scene
function create( data ){
    // ...
}

function init( data ){
    // ...
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda