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

5 years ago by AndreasElia


I'm currently having a problem with some GUI entities, they seem to stutter whenever the camera/screen moves.


5 years ago by AndreasElia

My bad, forgot to post source code.

5 years ago by TC

Replace update method with below

update: function() {
	this.pos.x = this.posBar.x;
	this.pos.y = this.posBar.y;
	if( this.currentAnim ) {

By removing this.parent() we are ignoring the games entity positioning and leaving it in a fixed position on the screen which is what you are trying to achieve I believe.

As we have removed this.parent(), we have added in this.curentAnim.update() to ensure the animation still updates.

I'm not sure why you have this.posBar, why not just set this.pos.x and this.pos.y to those values in the first place?


5 years ago by AndreasElia

Thanks for your help but that's a little bit of a step back from what I wanted to achieve. I currently have a player that can move in a "top down" fashion but wish the "slot" GUI entity to stick to the cameras position so that it is constantly on screen and not fixed to the actual map. posBar was from testing and lazyness, hopefully it isn't too confusing.

GIF using your suggestion, fixes the slots to the map.

5 years ago by Joncom

You can simply draw the entity where you want.

// Assuming you want the entity drawn 10 pixels off the top left of canvas...
pos: { 
    x: 10,
    y: 10
draw: function() {
    /* Don't call this.parent(); */
    this.currentAnim.draw(this.pos.x, this.pos.y);

5 years ago by AndreasElia

Thank you very much Joncom, that worked a charm.
Page 1 of 1
« first « previous next › last »