Somehow the message got deleted, so I'm reposting it from my email
archive:
-------------------------------
Hi to everyone,
I have found the RE around the web while looking for a HTML5/canvas
capable engine to use for a project, but I am facing a problem I
really don't know how to solve.
I have many objects running on my application, and all of them will be
moved by the player, althogh the player will control only one object
at a time.
In these objects' constructor I do (among other things):
Engine.initObject("Gameobject_piece", "Object2D", function() {
var gameobject_piece = Object2D.extend({
constructor: function(mytype, px, py, fixedprop, f_time,
ref_to_field) {
this.add(KeyboardInputComponent.create("input"));
}
}
in the "release" and "destroy" methods I set other fields of the
object to null/call destroy on them. They are something like:
destroy: function() {
this.move_vec.destroy();
this.base();
},
release: function() {
this.base();
this.type = null;
this.orient = null;
this.fixed = null;
this.move_vec = null;
this.np = null;
this.havetorot = null;
this.falling_time = null;
this.willbekilled = null;
},
I am not touching the component, as it is done in the tutorials. Then,
during the game, these objects are simply destroyed called the
"destroy" methods, but the new created ones cannot be moved using the
keyboard. Firebug returns this error
this.getHostObject() is null
--> if (this.getHostObject().onKeyUp) { [component.keyboardinput.js]
and others, similar ones for all the other keyboard event functions.
Also, the key callback defined in the object are not called.
The strange things are that:
- Every now and them, some created objects move correctly (after the
first one, which always works fine)
- If keep the destroy method of the object "blank" (no statements at
all in it), everything seems to work, but of course objects are not
deleted from the field.
What am I missing?
Thank you in advance,
Rudi