How can i spawn objects randomly but always only on visible game window?
create object :
on layer (0)
x : random(viewportleft(0),viewportright(0))
y : random(viewporttop(0),viewportbottom(0))
Develop games in your browser. Powerful, performant & highly capable.
if you want the whole object to be within the viewport you should add or subtract object width and height to those values.
LittleStain thanks for reply
So you only have to use the x-position and set the y to viewportbottom(0)+0.5*objectheight.
Yeah that is progress for me thanks :D