How do I Create Random Sprite size layout

Get help using Construct 2

Post » Tue Dec 23, 2014 3:36 am

Hello everyone.

I have a layout size: 1500,700, and this event:
event.png


it works, but i would like that the creation of the object was only between 100 and 600 on Y axis, and not the total size o Y axis.

How can i do that?
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 4
Reputation: 183

Post » Tue Dec 23, 2014 5:37 am

By using the wonderful random(A,B) function, thus random(100,600)
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Dec 23, 2014 1:46 pm

Or, if you are allowing resize, random(LayoutHeight * x%, LayoutHeight * y%), where x% and y% are the minimum and maximum %of the height they should appear.

For example:

In a 480 x 640 layout if you'd like to have they appear between 100 and 600, you should use random(LayoutHeight * 0.16, LayoutHeight * 0.94), so, if the layout resizes to double its original size (960x1280), instead of having sprites appearing only in the upper half of the screen (100-600) they'd still be distributed proportionally as you expected (200-1200)...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
19
S
5
G
1
Posts: 530
Reputation: 2,727


Return to How do I....?

Who is online

Users browsing this forum: DharmaOne, Euduardo, Nagval333 and 24 guests