Skip to main content

lol so theThe issue was in the sprite's initinit function.

Aparently, I started the drawing functions only if the sprite was alive. And sinceSince my sprite's image was drawn on a canvas then feed, and fed to the main canvas, there was no image to draw.

SINCETo fix it, I had to set all children in the sprite to dead (aka this.alive = false).

if (this.alive)  
{
    t.renderCanvas(this.drawer, this.img, this.imgOnDrawerX, this.imgOnDrawerY);
    t.renderWorld(this.drawer.canvas, this.pos.x, this.pos.y);
}

lol so the issue was in the sprite's init function.

Aparently, I started the drawing functions only if the sprite was alive. And since my sprite's image was drawn on a canvas then feed to the main canvas there was no image to draw.

SINCE, I had set all children in the sprite to dead (aka this.alive = false)

if (this.alive) {
    t.renderCanvas(this.drawer, this.img, this.imgOnDrawerX, this.imgOnDrawerY);
    t.renderWorld(this.drawer.canvas, this.pos.x, this.pos.y);
}

The issue was in the sprite's init function.

Aparently, I started the drawing functions only if the sprite was alive. Since my sprite's image was drawn on a canvas, and fed to the main canvas, there was no image to draw.

To fix it, I had to set all children in the sprite to dead (aka this.alive = false).

if (this.alive)  
{
    t.renderCanvas(this.drawer, this.img, this.imgOnDrawerX, this.imgOnDrawerY);
    t.renderWorld(this.drawer.canvas, this.pos.x, this.pos.y);
}
Source Link
Cephas
  • 386
  • 1
  • 14

lol so the issue was in the sprite's init function.

Aparently, I started the drawing functions only if the sprite was alive. And since my sprite's image was drawn on a canvas then feed to the main canvas there was no image to draw.

SINCE, I had set all children in the sprite to dead (aka this.alive = false)

if (this.alive) {
    t.renderCanvas(this.drawer, this.img, this.imgOnDrawerX, this.imgOnDrawerY);
    t.renderWorld(this.drawer.canvas, this.pos.x, this.pos.y);
}