# Cannot update the game

**URL:** <https://phaser.discourse.group/t/cannot-update-the-game/6506>\
**Category:** Phaser 3\
**Created:** [May 31, 2020, 3:36pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506 "2020-05-31T15:36:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [May 31, 2020, 3:36pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/1 "2020-05-31T15:36:32Z")

</div>

There is no change in the game even if I make some changes in the game.

I mean, if i changed my text or sprite position to 300,300 from 100,300 there is no change in the game even if I reload it?

What is actually happening?

---

<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:** [May 31, 2020, 4:26pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/2 "2020-05-31T16:26:06Z")

</div>

Code please?

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [June 1, 2020, 1:40pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/3 "2020-06-01T13:40:39Z")

</div>

This is the index.html code,

```
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="phaser.min.js"></script>
</head>
<body>
	<script type="text/javascript" src="startScene.js"></script>
    <script type="text/javascript" src="gameScene.js"></script>
    <script type="text/javascript" src="game.js"></script>

</body>
</html>

```

Then this is game.js code,

```
const gamestate ={Score: 0,};
const config = {
type: Phaser.AUTO,
height: 650,
width: 650,
autoCenter:true,
backgroundColor: "000000",//2F4F4F
physics: {
    default: 'arcade',
    arcade:{
        gravity: {y: 200},
        enableBody:true,
    }
},
scene: [startScene,gameScene]
}
const game = new Phaser.Game(config);

```

This is startScene.js code,

```
class startScene extends Phaser.Scene{
	constructor(){
		super({key: 'startScene'})
	}
	create(){
		this.add.text(300,300,'Click to Play');
		this.input.on('pointerdown',function(){
			this.scene.stop('startScene')
			this.scene.start('gameScene')
		});
	}
}

```

This is gameScene.js code,

```
class gameScene extends Phaser.Scene{
	constructor(){
		super({key: 'gameScene'})
	}
..........

```

What is the problem?

---

<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 1, 2020, 3:22pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/4 "2020-06-01T15:22:54Z")

</div>

Did it ever work? Does the console show errors?

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [June 1, 2020, 3:27pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/5 "2020-06-01T15:27:41Z")

</div>

Yeah, the console says _ **this.scene.stop** _ is not a function.

Before making separate scenes, the main game actually worked but ever since I created scenes it is not working. Scenes are not changing and if I change something in code, nothing changes when I reload the game.

Actually, console says all these:

_startScene.js:8 Uncaught TypeError: this.scene.stop is not a function_  
_at initialize. (startScene.js:8)_  
_at initialize.h.emit (phaser.min.js:1)_  
_at initialize.processDownEvents (phaser.min.js:1)_  
_at initialize.update (phaser.min.js:1)_  
_at initialize.updateInputPlugins (phaser.min.js:1)_  
_at initialize.onTouchStart (phaser.min.js:1)_  
_at HTMLCanvasElement.onTouchStart (phaser.min.js:1)_

---

<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 1, 2020, 3:33pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/6 "2020-06-01T15:33:48Z")

</div>

> [@Rubek](#):
>
> startScene.js:8 Uncaught TypeError: this.scene.stop is not a function

You need to fix this first.

[https://github.com/samme/phaser3-faq/wiki#how-do-i-use-this-in-a-scene](https://github.com/samme/phaser3-faq/wiki#how-do-i-use-this-in-a-scene)

---

<div class="post-metadata">

**Author:** ![Phailser](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phailser/32/3187_2.png) [@Phailser](https://phaser.discourse.group/u/Phailser)\
**Post date:** [June 1, 2020, 4:51pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/7 "2020-06-01T16:51:24Z")

</div>

Exactly as @samme said. I would recommend the last point on the list linked by samme and use an arrow function in place of your actual function.

```
 this.input.on('pointerdown', ()=>{
     this.scene.stop('startScene')
     this.scene.start('gameScene')
    });
```

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [June 2, 2020, 2:46am UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/8 "2020-06-02T02:46:16Z")

</div>

After I used the arrow function, the scene changes to gameScene but platforms, obstacles etc are not visible.

---

<div class="post-metadata">

**Author:** ![Phailser](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phailser/32/3187_2.png) [@Phailser](https://phaser.discourse.group/u/Phailser)\
**Post date:** [June 2, 2020, 8:31pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/9 "2020-06-02T20:31:38Z")

</div>

Is it actually changing to the gameScene? Ensure its added to the game config and delete the stop scene line. The scene will be shutdown automatically when you call start for another scene.

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [June 3, 2020, 3:51pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/10 "2020-06-03T15:51:14Z")

</div>

yeah its changing to the game scene but physics do not work and only one sprite is visible. No enemies are visible.

---

<div class="post-metadata">

**Author:** ![Phailser](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phailser/32/3187_2.png) [@Phailser](https://phaser.discourse.group/u/Phailser)\
**Post date:** [June 3, 2020, 7:34pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/11 "2020-06-03T19:34:26Z")

</div>

Can you show the code?

---

<div class="post-metadata">

**Author:** ![Rubek](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@Rubek](https://phaser.discourse.group/u/Rubek)\
**Post date:** [June 4, 2020, 1:06pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/12 "2020-06-04T13:06:24Z")

</div>

Yeah, its shown above

---

<div class="post-metadata">

**Author:** ![Phailser](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phailser/32/3187_2.png) [@Phailser](https://phaser.discourse.group/u/Phailser)\
**Post date:** [June 4, 2020, 4:32pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/13 "2020-06-04T16:32:42Z")

</div>

For the game scene

---

<div class="post-metadata">

**Author:** ![Darko](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/darko/32/3335_2.png) [@Darko](https://phaser.discourse.group/u/Darko)\
**Post date:** [June 4, 2020, 4:50pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/14 "2020-06-04T16:50:06Z")

</div>

Hi

> [@Rubek](#):
>
> ```javascript
> this.input.on('pointerdown',function(){
> this.scene.stop('startScene')
> this.scene.start('gameScene')
> });
> 
> ```

I would try changing this function to an arrow function…

```javascript
this.input.on('pointerdown',() => {
			this.scene.stop('startScene')
			this.scene.start('gameScene')
		});

```

or a binding to “this”

```javascript
this.input.on('pointerdown',function(){
			this.scene.stop('startScene')
			this.scene.start('gameScene')
		}, this);

```

---

<div class="post-metadata">

**Author:** ![Ross\_Evan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/ross_evan/32/1142_2.png) [@Ross\_Evan](https://phaser.discourse.group/u/Ross_Evan)\
**Post date:** [June 12, 2020, 7:49pm UTC](https://phaser.discourse.group/t/cannot-update-the-game/6506/15 "2020-06-12T19:49:46Z")

</div>

Try clearing your browser cache, I remember when I first started I had that same problem, until I learned more about node and eventually use nodemon for auto restart of the server. It drove me crazy because I kept changing code, yet nothing happened.
