Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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))
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