# Rectangle problem as object moves

**URL:** <https://phaser.discourse.group/t/rectangle-problem-as-object-moves/3354>\
**Category:** Phaser 3\
**Created:** [August 4, 2019, 4:36pm UTC](https://phaser.discourse.group/t/rectangle-problem-as-object-moves/3354 "2019-08-04T16:36:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [August 4, 2019, 4:36pm UTC](https://phaser.discourse.group/t/rectangle-problem-as-object-moves/3354/1 "2019-08-04T16:36:20Z")

</div>

Hi, I have created a constructor class for my Healthbar which looks as follows:

```javascript
class HealthBar extends Phaser.GameObjects.Image {
    constructor(scene, x, y) {
        super(scene, x, y);
        scene.add.existing(this);

        this.scene.add.rectangle(x, y, 60, 10, 0xFFFF00).setStrokeStyle(2, 0x000000);
    }
}

```

Everything works fine as for now however when I call it into my Enemy class constructor the rectangle is leaving a mark every time the enemy tank moves. (the tank object has a set velocity) Here is a screenshot:

 ![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/2/24bd7ba454fd40963690c1402b71ae65b9e2651c.png)

This is how I have called it into my Enemy class constructor:

```javascript
let healthy = new HealthBar(this.scene, this.enemy.x, this.enemy.y);

```

Does anybody seem to know why it is leaving a mark?
