Jump to content

Cannot read property 'FRAGMENT_SHADER' of null


Jasonfroz
 Share

Recommended Posts

Need more details. Ideally a link to some code + the device/browser you were testing on.

var BIT_WIDTH = 48;//15var BIT_HEIGHT = 32;//15var FIRST = true;var PLAY = false;var parent = document.getElementById('container');var screen_width = parent.clientWidth > window.innerWidth ? window.innerWidth : parent.clientWidth;var screen_height = parent.clientHeight > window.innerHeight ? window.innerHeight : parent.clientHeight;var game = new Phaser.Game(screen_width,screen_height,Phaser.Canvas,parent);function main(){	console.log('main');	this.menu_group = undefined;	this.ready_group = undefined;};main.prototype.preload = function(){	console.log('preload');};main.prototype.create = function(){	console.log('create',this.ready_group);	this.game.stage.backgroundColor = '#cceeff';	if(FIRST)		this.createMenu();	else{		this.createReady();	}};main.prototype.createMenu = function(){	console.log('menu');	this.menu_group = this.game.add.group();		var yangie_safe = this.game.add.text(BIT_WIDTH*7.5,BIT_HEIGHT*5,'Yangie Safe',{font:'48px System Bold',fill:'#000000'});	yangie_safe.anchor.setTo(0.5,0.5);	this.menu_group.add(yangie_safe);		var play_button = this.game.add.sprite(BIT_WIDTH*5,BIT_HEIGHT*10,'xx');	play_button.anchor.setTo(0.5,0.5);	play_button.input.start();	play_button.events.onInputDown.add(this.onPlay,this);	this.menu_group.add(play_button);};main.prototype.createReady = function(){	console.log('ready');	this.ready_group = this.game.add.group();		var ready_text = this.game.add.text(BIT_WIDTH*7.5,BIT_HEIGHT*4,'Get Ready!',{font:'36px System Bold',fill:'#000000'});	ready_text.anchor.setTo(0.5,0.5);	this.ready_group.add(ready_text);		this.howto = this.game.add.sprite(BIT_WIDTH*7.5,BIT_HEIGHT*6,'oo');	this.howto.anchor.setTo(0.5,0.5);	this.ready_group.add(this.howto);		var howto_text = this.game.add.text(BIT_WIDTH*7.5,BIT_HEIGHT*8,'Drag>>Slide>>Drop',{font:'20px System Bold',fill:'#000000'});	howto_text.anchor.setTo(0.5,0.5);	this.ready_group.add(howto_text);};game.state.add('main',main); game.state.start('main');

this my code i use Eclipse develop tools run on Chrome Browser

 

thank rich.

Link to comment
Share on other sites

Your constructor should be:

var game = new Phaser.Game(screen_width,screen_height,Phaser.CANVAS,parent);

(caps for CANVAS) Otherwise it will default to AUTO, which I'm guessing is swapping to WebGL and then failing to do something. Just a guess though, you'll need to provide a link so we can test it live if this doesn't fix it really.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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