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

1 decade ago by Tharuin


I'm using an entity for my crosshair following the mouse and a health bar on the top left corner. My problem is that it looks like the crosshair is always a few frames behind the mouse itself and the health bar ( actually a UI element ) always a few frames behind the current "camera".

I'm using the following code in the update methods to update the positions:

this.pos.x = this.aimedPosition.x +;
this.pos.y = this.aimedPosition.y +;

var mouseX = ig.input.mouse.x +;
var mouseY = ig.input.mouse.y +;
this.pos.x = mouseX - this.size.x/2;
this.pos.y = mouseY - this.size.y/2;

Is it wrong to use entities for that?

1 decade ago by Husten

perhaps its a solution to change the mousecursor via css when the mouse is over the canvas element?

1 decade ago by Tharuin

I fixed the crosshair thing by just leaving "this.parent();" from the update method of the crosshair entity. I did the same for the health bar entity but it didn't fix it for it. :(
Page 1 of 1
« first « previous next › last »