How do I create expression for 'random destroyed'

Get help using Construct 2

Post » Tue Jan 31, 2017 3:24 pm

Stay with me...

I have 6 different disks: LG, MD, SM that travel at angle 90. LG, MD, SM that travel at angle 180.

The disks are labeled(what else) 90LG, 90MD, etc.etc.

I have this event:
System > every random (1, 1.5) secs - System > create object 90LGDisk on layer at .......

90LGDisk > On created - set bullet at 90/ set bullet speed to random (50,80)

What i would like to do is:
After a certain amount of random time or random 90LGDisks destroyed > increase their bullet speed by a random amount.

I tried using a GV to set their bullet speed at first, then increase that over a random time or random number of disks destroyed. But...I can't figure out the expression to use.

I would rather use 'random number of disks destroyed' - since the GV (90LGDisk_Count) counts how many 90LG Disks are destroyed, when this gets to a random amount, it resets to 0 and smaller disks are created, and it would be more uniform than using a random time.

Basically it would be something like:
90LGDisk > On Destroyed
___System > For each random (100, 120) - 90LGDisk > add to (90LGSpeed +20)

That's not it of course, but i hope you get the idea.


Big thanks for any help with this.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Tue Jan 31, 2017 3:29 pm

Look at my second response in here, it seems related :
viewtopic.php?f=147&t=186989

You probably need to go to the On Created events for this, since the discs will be created with a set speed. You can set the speed there to a global variable and have this increase when a certain number of discs are destroyed.
B
47
S
17
G
81
Posts: 2,221
Reputation: 48,089

Post » Tue Jan 31, 2017 7:01 pm

plinkie wrote:Look at my second response in here, it seems related :
viewtopic.php?f=147&t=186989

You probably need to go to the On Created events for this, since the discs will be created with a set speed. You can set the speed there to a global variable and have this increase when a certain number of discs are destroyed.


Thanks again for all the replies.

Could i somehow make that GVSpeed into random?

All the disks, LG, MD, SM move with an overlapping random speed. So the LG Disks move at (50, 80) and MD move at (60, 90).
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Tue Jan 31, 2017 8:07 pm

I would do it by having the GV for speed set to self+random(x,x) and then with the on created disc event have the speed initially as (50,80)+GV where GV is initially 0 but then increasing to a random amount on every number of discs destroyed. That way also if you want to have different speeds for different discs or for example, destroying 10 large discs only increases the speed for large discs, then you can have seperate GVs, so speed is (50,80)+GV, (60,90)+GV2.


To break it down....
Created LG disc at speed (50,80)+GVspeed
On (GV)LGdestroyed=20, set GVspeed to self+random(5,20)

Now when a new LG disc is created, speed is set at random(50,80)+random(5,20)
B
47
S
17
G
81
Posts: 2,221
Reputation: 48,089

Post » Tue Jan 31, 2017 8:35 pm

Admittedly I don't have a perfectly clear image of your goal, but have you considered utilizing a percent chance to speed up after a certain point rather than a random fixed number? The result should be similar.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,695
Reputation: 64,438


Return to How do I....?

Who is online

Users browsing this forum: roracle and 7 guests