Converts world coordinates (for example, an object's position or a hit point) into screen coordinates, useful for drawing UI elements or effects on the canvas.
WorldToScreen(x, y)
{
x: screenValueX,
y: screenValueY
}
// Convert the player's world position to screen position to draw text
const pos = WorldToScreen(player.x, player.y);
drawText("Player", pos.x, pos.y - 20);
ScreenToWorld().