I'm making a game and i want an object to spawn at a random point on the screen. How do i do that??
Thank you.
Develop games in your browser. Powerful, performant & highly capable.
Random point on the layout -
X: random(layoutWidth)
Y: random(layoutHeight)
Random point on the screen -
X: random(ViewportLeft(layer), ViewportRight(layer))
Y: random(ViewportTop(layer), ViewportBottom(layer))