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 BBreitenbach

What do I need to do to get the level editor to recognize a class I extended from ig.Class ?

I created a custom class to write text using the canvas context, and I put it as a speaking text object to draw within my character entity.
ERROR: Uncaught TypeError: undefined is not a function
EXAMPLE:
*******
speakCanvasText: new ig.Canvastext({ fontcolor: "white", text: "Test Text", width: 30, location: { x: 25, y: 25 } }),

******
I then use a write method during the draw to display it and all the lines if it is multiline.

It just looks like the level editor can't see the class, but I am not sure what else to do. I am fairly amateur, so I just copied another class that looked similar in nature, and everything was working great until I went to edit my level.

1 decade ago by stahlmanDesign

In your entity you probably need to put
if (!ig.global.wm) {
 // your custom code here
}

So it won't try to execute while in the level editor (Weltmeister).

Also (or alternatively), in your entity, set the variable
...
speakCanvasText: null,
...

and only define it in the init function of your entity:
init: function(){
	this.speakCanvasText  = new ig.Canvastext({ fontcolor: "white", text: "Test Text", width: 30, location: { x: 25, y: 25 } })
}
Page 1 of 1
« first « previous next › last »