Jump to content

Can't call a function!


Tixxi
 Share

Recommended Posts

I am just starting with Phaser and figured I should learn 3 instead of an earlier version. I have created a game, called in a scene, but can't seem to call a simple function. I have made tons of games in Actionscript, so am hoping to make this transition to Phaser easily. I am probably missing something basic or have screwed up something since I am going from 4 different tutorials. lol :) Any help would be great!

 

When I run this, it gets to line 28 and then says SyntaxError: bad method definition. Help!

 

Oh,... and while I have your attention... Anyone have a particular package for Sublime that helps with Phaser or Javascript?

class FactChoice extends Phaser.Scene
{
	constructor()
	{
		super({key:"FactChoice"});
	}
	preload()
	{
		this.load.image('0', 'assets/images/numbers/0.png');
		this.load.image('1', 'assets/images/numbers/1.png');
		this.load.image('2', 'assets/images/numbers/2.png');
		this.load.image('3', 'assets/images/numbers/3.png');
		this.load.image('4', 'assets/images/numbers/4.png');
		this.load.image('5', 'assets/images/numbers/5.png');
		this.load.image('6', 'assets/images/numbers/6.png');
		this.load.image('7', 'assets/images/numbers/7.png');
		this.load.image('8', 'assets/images/numbers/8.png');
		this.load.image('9', 'assets/images/numbers/9.png');
		this.load.image('next', 'assets/images/btnNextLevel.png');
		this.load.image('BG', 'assets/images/sky.png');
	}
	create()
	{
		console.log("time to make FactChoice");
		
		arraysChosen();
	}
	arraysChosen: function(){
		console.log("hey");
	}
}

 

Link to comment
Share on other sites

Hahaha I did not realize that the numbers didn't come over. Sorry about that. And, yes, it was arraysChosen that was the problem. I finally got that fixed by changing it to this.arraysChosen(); and then the function was just arraysChosen()... Can't believe it took me like 3 hours to just make a function call. Hopefully it picks up speed now!

 

Thank you so much for the Sublime packages! You rock!!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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