user1186409
user1186409

Reputation: 111

Changing the order of images dynamically in HTML5 - Canvas

I'm trying to make a little isometric game.There are objects and players.

In init function;

drawObject();
drawPlayer();

So in screen player always shown in top of objects because player drawn after objects but it should be like that; if y-coordinate of the object is more than the player's y-coordinate then object must be drawn later and shown on top. Or is there anything like z-index property for drawImage() function for canvas?

Upvotes: 0

Views: 652

Answers (1)

Jonas
Jonas

Reputation: 128927

No, there is no z-index property for the Canvas. The canvas will be drawn in the order you code your drawing primitives.

Upvotes: 3

Related Questions