# staticBody class with Arcade?

**URL:** <https://phaser.discourse.group/t/staticbody-class-with-arcade/7718>\
**Category:** Phaser 3\
**Created:** [October 17, 2020, 5:29pm UTC](https://phaser.discourse.group/t/staticbody-class-with-arcade/7718 "2020-10-17T17:29:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![espace](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/espace/32/1405_2.png) [@espace](https://phaser.discourse.group/u/espace)\
**Post date:** [October 17, 2020, 5:29pm UTC](https://phaser.discourse.group/t/staticbody-class-with-arcade/7718/1 "2020-10-17T17:29:52Z")

</div>

Hi,

I’m searching to make a static class of an object.

No problem with a simple sprite :

```
class Arcade extends Phaser.Physics.Arcade.Sprite {
	constructor(scene, x, y, texture) {
		super(scene, x, y, texture)
		scene.add.existing(this)
		scene.physics.add.existing(this)
	}
} 

```

but for a static object like :  
`atari = this.physics.add.staticImage(400, 300, 'atari');`

this code don’t woks :

```
class Static extends Phaser.Physics.Arcade.StaticImage {
	constructor(scene, x, y, texture) {
		super(scene, x, y, texture)
		scene.add.existing(this)
		scene.physics.add.existing(this)
	}
} 

```

How do you do to create a class with a static Image ?

Thanks

---

<div class="post-metadata">

**Author:** ![jjcapellan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jjcapellan/32/542_2.png) [@jjcapellan](https://phaser.discourse.group/u/jjcapellan)\
**Post date:** [October 17, 2020, 5:55pm UTC](https://phaser.discourse.group/t/staticbody-class-with-arcade/7718/2 "2020-10-17T17:55:20Z")

</div>

Hi @espace,  
The **existing** method of `Arcade.Factory` has an optional second param **isStatic** for this purpose.  
More info in the [docs](https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.Factory.html#existing__anchor)

Regards.

---

<div class="post-metadata">

**Author:** ![espace](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/espace/32/1405_2.png) [@espace](https://phaser.discourse.group/u/espace)\
**Post date:** [October 17, 2020, 6:59pm UTC](https://phaser.discourse.group/t/staticbody-class-with-arcade/7718/3 "2020-10-17T18:59:40Z")

</div>

Sorry but i don’t understand, i try this :

```
class Static extends Phaser.Physics.Arcade.Factory {
	constructor(scene, x, y, texture) {
		super(scene, x, y, texture)
		this.isStatic = true
		scene.add.existing(this)
		scene.physics.add.existing(this)
	}
}

```

but it doens’t works.

---

<div class="post-metadata">

**Author:** ![jjcapellan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jjcapellan/32/542_2.png) [@jjcapellan](https://phaser.discourse.group/u/jjcapellan)\
**Post date:** [October 17, 2020, 9:18pm UTC](https://phaser.discourse.group/t/staticbody-class-with-arcade/7718/4 "2020-10-17T21:18:05Z")

</div>

Don’t worry @espace .  
The `Arcade.Factory` object is the same as the [add](https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.ArcadePhysics.html#add__anchor) property of the physics plugin.  
In a nutshell, what I wanted to say was this:

```javascript
scene.physics.add.existing(this, true) // Adds static body
scene.physics.add.existing(this, false) // Adds dynamic body (default)

```

Regards.
