Hive64 Posted July 23, 2014 Share Posted July 23, 2014 Okay I must be doing something stupid. I keep getting the error "Uncaught TypeError: Cannot read property 'p2' of undefined" on line 25 of the following code;var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', { preload: preload, create: create, update: update});function preload() { game.load.spritesheet('dude', 'assets/dude.png', 32, 48);}var player, sprite;var players;var GRID_SIZE = 32;function create() { //Enable p2 physics game.physics.startSystem(Phaser.Physics.P2JS); player = game.add.sprite(200, 200, 'dude'); //enable physics game.phsysics.p2.enableBody(player); player.body.setZeroDamping(); player.body.fixedRotation = true;}function update() { }function movePlayer(x, y) { player.x += x * GRID_SIZE; player.y += y * GRID_SIZE;}From what i understand, the order is: create game (line 1), start the physics type of my choice (line 20), then enable that physics on the sprite that I created (line 25). I'm a newbie so any tips are more than welcome!! Link to comment Share on other sites More sharing options...
WhiteSoul Posted July 23, 2014 Share Posted July 23, 2014 You have a typo. Write "physics" instead of "phsyics" and it should work. Link to comment Share on other sites More sharing options...
Hive64 Posted July 23, 2014 Author Share Posted July 23, 2014 ARGGGGGGG wow, to think that things like this still get me... thanks lol. Link to comment Share on other sites More sharing options...
WhiteSoul Posted July 23, 2014 Share Posted July 23, 2014 You're welcome, this kind of stuff is usual. Link to comment Share on other sites More sharing options...
Recommended Posts