Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda