Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!