# I need to use matter and arcade on different sprites

**URL:** <https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118>\
**Category:** Phaser 3\
**Created:** [February 9, 2020, 8:18pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118 "2020-02-09T20:18:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igglepud](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Igglepud](https://phaser.discourse.group/u/Igglepud)\
**Post date:** [February 9, 2020, 8:18pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/1 "2020-02-09T20:18:02Z")

</div>

I read through the other posts and re-wrote a bunch of code, still nothing. I can get arcade to work, or I can get matter to work, but not both. One or the other is always undefined. Below is my config file. I tried rewriting the scene{} part instead of scene[], and that just made things worse.  
I tried getting rid of the “default” line, and that killed it. I cannot put both in “default”, or am I missing the syntax to do so?

// set game configuration  
let config = {  
type: Phaser.AUTO,  
width: 900,  
height: 700,  
scene: [preloadScene, titleScene, gameScene, gameoverScene],  
pixelArt: false,  
physics: {  
default: ‘arcade’,  
arcade: {gravity: {y: 1000},  
// debug: true,  
},

matter:{gravity:{y:.5}},  
},  
};

//create new game and send configuration  
let game = new Phaser.Game(config)

---

<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:** [February 9, 2020, 8:46pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/2 "2020-02-09T20:46:49Z")

</div>

[http://labs.phaser.io/view.html?src=src\physics\multi\arcade%20and%20matter.js](http://labs.phaser.io/view.html?src=src%5Cphysics%5Cmulti%5Carcade%20and%20matter.js)

---

<div class="post-metadata">

**Author:** ![Igglepud](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Igglepud](https://phaser.discourse.group/u/Igglepud)\
**Post date:** [February 9, 2020, 8:53pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/4 "2020-02-09T20:53:05Z")

</div>

My guess is something is different there, because it is all one long scene in the example. My project has several different JS files for each scene.

---

<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:** [February 9, 2020, 9:11pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/5 "2020-02-09T21:11:37Z")

</div>

It has to go in the scene config, not the game config.

---

<div class="post-metadata">

**Author:** ![Igglepud](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Igglepud](https://phaser.discourse.group/u/Igglepud)\
**Post date:** [February 9, 2020, 9:41pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/6 "2020-02-09T21:41:46Z")

</div>

So, let’s say I’m adding physics to “game.js”, how do I add a config for the scene and where does it go? Into game.js?

---

<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:** [February 9, 2020, 10:12pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/7 "2020-02-09T22:12:21Z")

</div>

What does `gameScene` look like?

---

<div class="post-metadata">

**Author:** ![Igglepud](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Igglepud](https://phaser.discourse.group/u/Igglepud)\
**Post date:** [February 9, 2020, 10:33pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/8 "2020-02-09T22:33:01Z")

</div>

let gameScene = new Phaser.Scene(‘Game’);

gameScene.init = function(){

};  
// create after preload  
gameScene.create = function(){  
};  
gameScene.update = function(){  
};

I can give you the full code if you need, but that is the framework for any scenes that I run. From there, I can do things like this.unicorn=this.physics.add.sprite() or this.matter.add.sprite(), but it never lets me use both.

---

<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:** [February 9, 2020, 11:50pm UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/9 "2020-02-09T23:50:22Z")

</div>

```javascript
let gameScene = new Phaser.Scene({
  key: 'Game',
  physics: {
    arcade: { gravity: { y: 1000 } },
    matter: { gravity: { y: 0.5 } }
  }
});
// etc.

```

---

<div class="post-metadata">

**Author:** ![Igglepud](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@Igglepud](https://phaser.discourse.group/u/Igglepud)\
**Post date:** [February 10, 2020, 12:10am UTC](https://phaser.discourse.group/t/i-need-to-use-matter-and-arcade-on-different-sprites/5118/10 "2020-02-10T00:10:36Z")

</div>

Man, that was waaaaaaaaay too simple. So scenes are functions too. 😅 Thanks so much! It’s all working now.
