I add Sprites dynamically using a time event. I can’t find a way to bring new graphics (filled rectangle) over the created sprites.
Sprints are always on top
create()
{
var graphics = game.add.graphics(0, 0);
graphics.beginFill(0xFFFF0B);
graphics.drawRect(0, 0, windowWidth, 70);
graphics.endFill();
timer = game.time.events.loop(1500, addSprite, this);
}
addSprite()
{
sprite= game.add.sprite(20, 30, 'sprite');
}
Any help?
source
share