How can i spawn objects randomly but always only on visible game window?
bump
create object :
on layer (0)
x : random(viewportleft(0),viewportright(0))
y : random(viewporttop(0),viewportbottom(0))
if you want the whole object to be within the viewport you should add or subtract object width and height to those values.
Develop games in your browser. Powerful, performant & highly capable.
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