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 papyhardcore

Hi,

Here is my problem.
When I open the editor I get this error message:

The following entity classes were not loaded due to
file and class name mismatches: 

lib/game/entities/Player.js (expected name: EntityPlayer)

Main.js :
http://pastebin.com/5h7XiaZs
Player.js :
http://pastebin.com/jqH2CzDH

I don't understand.

1 decade ago by dominic

You should see some errors in your console before that one. Particularly, in your Player.js you set anim to the ig.Animation Class and animSheet to the ig.AnimationSheet Class. This trips up the creation of your EntityPlayer Class (again, there should be an error in the console) so Weltmeister can't find it.

What you wanted is to set animSheet to an instance of ig.Animation - i.e. you need the new keyword:

EntityPlayer = ig.Entity.extend({
	size: {x: 150, y: 32},
	collides: ig.Entity.COLLIDES.FIXED,
	animSheet: new ig.AnimationSheet('media/player.png', 150, 32),

	init: function(x, y, settings) {
		this.parent(x, y, settings);
		this.addAnim('anim', 0.1, [0]);
	},
    // ...
});

(I&039;m not sure what your #anim was supposed to be, so I removed it.)

1 decade ago by papyhardcore

I do not know why I added this line before posting.
"anim: ig.Animation" 

Even without it I still have the same error.

The following entity classes were not loaded due to
file and class name mismatches: 

lib/game/entities/Player.js (expected name: EntityPlayer)

Player.js : http://pastebin.com/VHhEysyV
main.js : http://pastebin.com/qvZKZFtu

Files :
http://hpics.li/22ac7ab

Thx.

1 decade ago by dominic

To quote myself:

Quote from dominic
You should see some errors in your console before that one.

(...)

What you wanted is to set animSheet to an instance of ig.Animation - i.e. you need the new keyword:

(...)
	animSheet: new ig.AnimationSheet('media/player.png', 150, 32),

1 decade ago by papyhardcore

Thx a lot.
Sorry I misread.
Page 1 of 1
« first « previous next › last »