How do I create expression for 'random destroyed'

0 favourites
  • 5 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • 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.

  • Look at my second response in here, it seems related :

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Look at my second response in here, it seems related :

    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).

  • 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)

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)