Jump to content

Beginner need help this.physics.arcade is undefined


Luka
 Share

Recommended Posts

Hi everyone ! 

I am new to Phaser and i want make my own program for the first time. 

I start it but i can't understand one error

"this.physics.arcade is undefined" After many looks at the doc, it's look like there is no sentance prob.

  var config = {
        type: Phaser.AUTO,
        width: 1366,
        height: 800,
		physics:{
			default: "arcade",
			arcade: {
				
				debug: false
			}
		},
        scene: {
            preload: preload,
            create: create,
            update: update,
			render: render
        }
    };

    var game = new Phaser.Game(config);
	
	/************GLOBAL VAR**********/
	var player; //player object
	player_spd = 150;
	
    function preload ()
    {
		this.load.image("player", "assets/sprites/Player.png")
    }

    function create ()
    {
		//player
		player = this.physics.add.sprite(1366/2, 800/2, "player");
		
		
		//controls
		keys_var = this.input.keyboard.createCursorKeys();
    }
	
    function update ()
    {
		//oriente le vaisseau vers la souris
		 player.rotation = this.physics.arcade.angleToPointer("player");
	
		
    }
	function render()
	{

		this.debug.spriteInfo(player, 32,32);
	}

</script>

So i ask you help.

 

ty!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...