How to set an object to random size with at least 50 diff...

Get help using Construct 2

Post » Sat Dec 19, 2015 9:52 pm

I want to set some objects to a random size between (200, 400)
But I don't want it to set (example) to 159 and then 162 but with at least 50 pixels difference between it.
Does someone knows how to do this?

Kind regards,

Niek,
B
6
S
2
Posts: 114
Reputation: 874

Post » Sat Dec 19, 2015 9:58 pm

Get a result from random(4,8) and multiply it by 50
B
19
S
6
G
7
Posts: 55
Reputation: 4,157

Post » Sat Dec 19, 2015 10:59 pm

@MikeHart I think I'am to noob to understand... XD
B
6
S
2
Posts: 114
Reputation: 874

Post » Sat Dec 19, 2015 11:32 pm

You could do it like this:

Give the sprite an instance variable SizeFacto

sprite on created
> sprite set SizeFactor : choose(4,5,6,7,8)
> sprite set width : 50*sprite.SizeFactor
> sprite set height: 50*sprite.SizeFactor

that way the size will be 200,250,300,350 or 400px
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 19, 2015 11:34 pm

@LittleStain Solved by you!

Thanks😉
B
6
S
2
Posts: 114
Reputation: 874

Post » Sat Dec 19, 2015 11:41 pm

Sorry, i didn't know that you needed a code example.
B
19
S
6
G
7
Posts: 55
Reputation: 4,157

Post » Sun Dec 20, 2015 12:14 am

@MikeHart No problem, I didn't know it either so ;-)
B
6
S
2
Posts: 114
Reputation: 874

Post » Sun Dec 20, 2015 12:43 am

Message: Niek can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
@LittleStain It doesn't spawn any objects more......
Can you see what is wrong?
http://regex.info/exif-data/e5fa85acf87 ... 874fe6.png


On the right down corner you can see that there are only coins spawning and no obstacles (in my project spawn1 and spawn 2) can you see if you can fix this?

Kind regards,

Niek,
B
6
S
2
Posts: 114
Reputation: 874

Post » Sun Dec 20, 2015 12:56 am

Your link has been changed, so it can't be visited..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Dec 20, 2015 2:26 am

@LittleStain I will fix it tomorrow, sorry!
B
6
S
2
Posts: 114
Reputation: 874

Next

Return to How do I....?

Who is online

Users browsing this forum: irbis, Yahoo [Bot], yuji567, zenox98 and 7 guests