# Texture.frame missing

**URL:** <https://phaser.discourse.group/t/texture-frame-missing/9748>\
**Category:** Phaser 3\
**Created:** [June 6, 2021, 3:00pm UTC](https://phaser.discourse.group/t/texture-frame-missing/9748 "2021-06-06T15:00:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FiveTony](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/fivetony/32/5265_2.png) [@FiveTony](https://phaser.discourse.group/u/FiveTony)\
**Post date:** [June 6, 2021, 3:00pm UTC](https://phaser.discourse.group/t/texture-frame-missing/9748/1 "2021-06-06T15:00:43Z")

</div>

friends, please help, the loaded frames suddenly began to be lost. in my game, I reuse created objects with new attributes, including random frames. and then they suddenly began to disappear at the setFrame stage. What could be causing this? here is my code:

```javascript
export default class MovableObject extends Phaser.GameObjects.Sprite {
    constructor(data) {
        super(data.scene, data.x, data.y, data.frame)
        this.init(data)
    }
    init(data) {
        this.scene.add.existing(this) 
        this.scene.physics.add.existing(this) 
        this.body.enable = true 
    }
    update() {
        if (this.active && this.isDead()) { 
            this.setAlive(false)
        }
    }
    setAlive(status) { 
        this.body.enable = status 
        this.setVisible(status) 
        this.setActive(status) 
    }
    reset(x, y) {
        this.x = x 
        this.y = y
        this.setAlive(true)
    }
    isDead() {
        return false
    }
    move() {
        this.body.setVelocityY(OBJECTS_VELOCITY)
    }
    static generateСoordinates() { 
        this.lastX = [this.lastX_N, this.lastX_P]
        let x = Phaser.Math.Between(300, 900) 
        for (let i in this.lastX) {
            if (x - SPRITE_WIDTH < this.lastX[i] && x + SPRITE_WIDTH > this.lastX[i]) x = Phaser.Math.Between(300, 900)
        }
        return x
    }
}

```

```javascript
export default class NegativeObject extends MovableObject {

    static generateAttributes() {
        let x = super.generateСoordinates()
        const y = Y_position
        return { x, y, frame: `rock0${Phaser.Math.Between(1, 3)}` }
    }
    static generate(scene) {
        const data = NegativeObject.generateAttributes()
        return new NegativeObject({
            scene,
            x: data.x,
            y: data.y,
            frame: data.frame,
        })
    }
    init(data) {
        super.init(data)
    }
    reset() {
        const data = NegativeObject.generateAttributes()
        super.reset(data.x, data.y)
        this.setFrame(data.frame)
    }
    isDead() { // проверка на выход за пределы экрана
        return this.y > HEIGHT
    }
}

```

 ![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/e/e45517954f7334d8141e56f78406abbadfb8f96e.jpeg)

[image]

[image]

---

<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:** [June 6, 2021, 3:10pm UTC](https://phaser.discourse.group/t/texture-frame-missing/9748/2 "2021-06-06T15:10:11Z")

</div>

👋

You may be confusing texture and frame arguments. In

```javascript
super(data.scene, data.x, data.y, data.frame)

```

`data.frame` is passed as the `texture` argument. But in

```javascript
this.setFrame(data.frame)

```

it’s used as `frame`.

---

<div class="post-metadata">

**Author:** ![FiveTony](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/fivetony/32/5265_2.png) [@FiveTony](https://phaser.discourse.group/u/FiveTony)\
**Post date:** [June 6, 2021, 3:28pm UTC](https://phaser.discourse.group/t/texture-frame-missing/9748/3 "2021-06-06T15:28:51Z")

</div>

many thanks. I replaced setFrame with setTexture and everything worked as it should!

[image]
