grumpygamer Posted April 8, 2015 Share Posted April 8, 2015 Hello,in an attempt to create a fading layer I've put these two lines of code together:window.onload = function() { var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO); game.add.graphics(0, 0); }that by itself throws the error in the subject:Cannot read property of 'graphics' or null. If I log game I get the object so not sure what's wrong.Thanks for any advice. Link to comment Share on other sites More sharing options...
Akshar Patel Posted April 8, 2015 Share Posted April 8, 2015 Do it this way.var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() {}function create() { //your graphics creation code.}function update() {} Link to comment Share on other sites More sharing options...
grumpygamer Posted April 8, 2015 Author Share Posted April 8, 2015 Thanks I thought I could do without defining all the functions. Link to comment Share on other sites More sharing options...
Recommended Posts