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

307
Views
Images not loading (Phaser)

I am trying to load/show my sprites into the Game Scene, but it's not working.

This is my code for the Game scene:

import Phaser from 'phaser';

export default class Game extends Phaser.Scene
{
    preload()
    {
        this.load.atlas("asteroid1","Bilder/asteroid1-0.png","Bilder/asteroid1.json")
        this.load.multiatlas("asteroid2","Bilder/asteroid2.json","Bilder")
    }

    create()
    {
        this.add.text(40,250, 'Hello')
        this.asteroid = this.add.sprite(200,200,"asteroid1")
        this.asteroid2 = this.add.sprite(100,200,"asteroid2")
        var background = this.add.sprite(0, 0, 'asteroid2', 'Bilder/asteroid2-0.png');
    }
}

This is the beginning of the json file that was created by TexturePacker.

{
        "textures": [
        {
            "image": "asteroid1-0.png",
            "format": "RGBA8888",
            "size": {
                "w": 2007,
                "h": 2002
            },
            "scale": 1,
            "frames": [
                {
                    "filename": "android01_00000.png",
                    "rotated": false,
                    "trimmed": true,
                    "sourceSize": {
                        "w": 2000,
                        "h": 2000
                    },
                    "spriteSourceSize": {
                        "x": 832,
                        "y": 865,
                        "w": 365,
                        "h": 443
                    },
                    "frame": {
                        "x": 1,
                        "y": 1,
                        "w": 365,
                        "h": 443
                    }
                },

My files

Pictures not loading

Errors

Appreciate your help!

about 4 years ago · Juan Pablo Isaza
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!