Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dahl

I have gotten the same error all morning:

Syntax Error: "missing } after property list (on column 9)"

this is my code:

ig.module(
	'game.entities.buddha'
)
.requires(
	'impact.entity'
)

EntityBuddha = ig.Entity.extend({
	
	size: {x:48, y:48},
	collides: ig.Entity.COLLIDES.ACTIVE,
	
	init: function( x, y, settings ) {
		this.parent( x, y, settings );
		
		if(ig.input.state("CanvasTouch")) {
			nY = ig.input.mousey;
			nX = ig.input.mousex;
			
			this.vel.x = 50;
			this.vel.y = 50; }
				
	}
	*update: function() {
		 this.overlappingEntities = [] // rests array
		 this.parent();
	}
	check: function( other ) {
		this.overlappingEntities.push( other instanceOf EntityBuddha);
		if(this.overlappingEntities.length >= 2) {
			.kill(this.overlappingEntities);
	 	}
	 }
});
});

the '*' is where i'm getting the error, it's not part of the code.

any help would be great, i've pulled out more hair this morning than i've lost this year. :)

Thanks!

1 decade ago by quidmonkey

You forgot .defines:

ig.module(
'game.entities.buddha'
)
.requires(
'impact.entity'
)
.defines(function(){

EntityBuddha = ig.Entity.extend({

1 decade ago by dahl

ok, added that. still get the error every time i add the "update....." if i comment that out or delete it completely, the code is error free. i've even gone as far as loading the puck.js from the source download. It looks great till i try to insert "update...." after the init: function() section.

thanks for the reply btw.

1 decade ago by rootbeerking

Hmm I'm not that great at coding, but from quickly looking at it I can at least point out that you are missing a comma after the "}" at the end of the init and update functions.
init: function( x, y, settings ) {
this.parent( x, y, settings );

if(ig.input.state("CanvasTouch")) {
nY = ig.input.mousey;
nX = ig.input.mousex;

this.vel.x = 50;
this.vel.y = 50; }

},

update: function() {
this.overlappingEntities = [] // rests array
this.parent();
},

Oh, and the "O" in "instanceOf" needs to be lowercase.
this.overlappingEntities.push( other instanceof EntityBuddha );

1 decade ago by aclelland

You need a comma just after the }

},
update: function() {

Each method needs to be separated by a comma

-edit- rootbeerking beat me to it :)

1 decade ago by dahl

wow, you guys are great! thank you so much! i was beginning to think that komodo hated me. lol
Page 1 of 1
« first « previous next › last »