# Error trying to load a sprite into my scene

**URL:** <https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178>\
**Category:** Phaser 3\
**Created:** [August 13, 2020, 9:46pm UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178 "2020-08-13T21:46:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johnathan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnathan/32/3868_2.png) [@Johnathan](https://phaser.discourse.group/u/Johnathan)\
**Post date:** [August 13, 2020, 9:46pm UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/1 "2020-08-13T21:46:41Z")

</div>

I’ve been trying to follow a youtube tutorial and I’m trying to add a sprite into my scene but I’m coming across an error I haven’t been able to find out much about. The error message is…

```javascript
phaser.js?d4ef:192479 Uncaught TypeError: this.resetCropObject is not a function
    at Object.MatterSprite [as Sprite]

```

Searching for the error I came across one github issue, [https://github.com/photonstorm/phaser/issues/5211](https://github.com/photonstorm/phaser/issues/5211), not sure if it’s related or not. I have tried pulling in the version from the master branch but the problem still persists.

My code is below.

```javascript
import { Scene } from 'phaser'
import store from '../../store/index';

export default class MainScene extends Scene {
  constructor () {
    super({ key: 'MainScene' });
  }

  preload() {
      this.load.atlas('player', '/assets/sprites/player.png', '/assets/sprites/player_atlas.json');
  }

  create () {
    this.player = Phaser.Physics.Matter.Sprite(this.matter.world, 0, 0, 'player', 'idle_behind_1');

    this.add.existing(this.player);
  }
}

```

[https://eager-goldberg-2913b2.netlify.app/](https://eager-goldberg-2913b2.netlify.app/)

---

<div class="post-metadata">

**Author:** ![Fanta](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@Fanta](https://phaser.discourse.group/u/Fanta)\
**Post date:** [August 13, 2020, 10:42pm UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/2 "2020-08-13T22:42:45Z")

</div>

What version are you using?

---

<div class="post-metadata">

**Author:** ![Johnathan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnathan/32/3868_2.png) [@Johnathan](https://phaser.discourse.group/u/Johnathan)\
**Post date:** [August 13, 2020, 10:54pm UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/3 "2020-08-13T22:54:57Z")

</div>

The latest stable tagged version, 3.24.1. I also tried the latest beta and the master branch directly. Same thing on them all.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [August 14, 2020, 5:58am UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/4 "2020-08-14T05:58:23Z")

</div>

```javascript
this.player = this.matter.add.sprite(0, 0, 'player', 'idle_behind_1');

```

---

<div class="post-metadata">

**Author:** ![Johnathan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnathan/32/3868_2.png) [@Johnathan](https://phaser.discourse.group/u/Johnathan)\
**Post date:** [August 14, 2020, 8:40am UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/5 "2020-08-14T08:40:25Z")

</div>

Thank you @samme, that was it. I must have been following along with an old version or something.

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [August 14, 2020, 10:42am UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/6 "2020-08-14T10:42:03Z")

</div>

By the way, the original mistake in your code was calling `Phaser.Physics.Matter.Sprite` as a function. It’s meant to be instantiated - `new Phaser.Physics.Matter.Sprite(...)`. The tutorial is wrong if it told you to use a function call.

Still, samme’s suggestion is the best solution. `this.matter.add.sprite` is equivalent to constructing a sprite and calling `add.existing` on it.

---

<div class="post-metadata">

**Author:** ![Johnathan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnathan/32/3868_2.png) [@Johnathan](https://phaser.discourse.group/u/Johnathan)\
**Post date:** [August 14, 2020, 10:54am UTC](https://phaser.discourse.group/t/error-trying-to-load-a-sprite-into-my-scene/7178/7 "2020-08-14T10:54:56Z")

</div>

You prompted me to go back and take a closer look, and yep, they’re instantiating it in the tutorial, I just missed it. Oops.

[![](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/8/8493f9dcc20e9629d1b3809160904df89ec9d2d6.jpeg "Phaser 3 Tutorial Preview - Full Course Available, see description") ](https://www.youtube.com/watch?v=fdXcD9X4NrQ)
