Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

loadl sprite sheets from json atlas #38

Open
Nuruddin999 opened this issue Dec 28, 2021 · 1 comment
Open

loadl sprite sheets from json atlas #38

Nuruddin999 opened this issue Dec 28, 2021 · 1 comment

Comments

@Nuruddin999
Copy link

Hello ! i cloned your repo , thanks , it is rather good starter. But i have some problem, how can i load sprite sheets.
i uploaded json atlas in Load.js file
Load.js--
dng.json // json of sprites
dng.png
Code:

import LOGO from './[email protected]';
import ScaledContainer from '../ScaledContainer/ScaledContainer';
import dngJSON from './dng.json'

export default class Logo extends ScaledContainer {
  constructor() {
    super();
    this.loader = new Loader()
    this.loader.add('dng',dngJSON)
    this.loader.load(()=>{
      console.log("ok")
      const texture = Texture.from('blob_1.png');
      //   const sprite = new Sprite(texture);
      //   this.addChild(sprite);
    })
    // sprite.anchor.x = 0.5;
    // sprite.anchor.y = 0.5;
    // sprite.position.set(1920 / 2, 1080 / 2);
  }
} ```

but this code shows error 

uncaught promise error // when i wrote ``` const texture = Texture.from('blob_1.png'); ````

So how can load sprite sheets with json atlas ?
@edwinwebb
Copy link
Owner

edwinwebb commented Dec 29, 2021 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants