0 Favourites

Individual Toggling

  • Hi again!

    What I am trying to do now is to make a type of mob toggle left or right at random time intervals. Problem is, when there are multiple mobs (Slimes), all Slimes would change direction at the same time. I've tried using (Pick Random Instance) to solve the selection issue, and then (4 seconds / Slime.Count) so that the time interval between the toggling in slime direction is the same.

    It worked for a bit, but now the slimes aren't even changing direction. Is there a more efficient way to do this? Thanks in advance!

  • Is there a way to determine which "Mob" the slimes are part of?

  • Wait I've got it working through this form of code

    It seems the problem stems from before the game has any Slime instances (In this case a Ribbon Pig), so by placing the condition of having at least 1 Slime I avoided that problem!

  • Bump, wanted to see if there was a better way of doing this as random picking is sometimes "biased" and it overpicks the same instance

  • For Each loop, or manually sorting through a counter

    but

    You can do this:

    Every 1 second>>>

    Enemyslime coinflip == 0>>

    set Enemyslime.Coinflip = random(1, 3)

    Enemyslime.coinflip == 1>>>

    set toggle to <left>

    Enemyslime.coinflip == 2>>>

    set toggle to <right>

    see if this starts choosing them better.

  • For Each loop, or manually sorting through a counter

    but

    You can do this:

    Every 1 second>>>

    Enemyslime coinflip == 0>>

    set Enemyslime.Coinflip = random(1, 3)

    Enemyslime.coinflip == 1>>>

    set toggle to <left>

    Enemyslime.coinflip == 2>>>

    set toggle to <right>

    see if this starts choosing them better.

    I see! I'll try when I get back, but do I need to put "round" in front of the random(1,3) so it doesn't choose decimals?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > For Each loop, or manually sorting through a counter

    >

    > but

    >

    > You can do this:

    >

    > Every 1 second>>>

    > Enemyslime coinflip == 0>>

    > set Enemyslime.Coinflip = random(1, 3)

    >

    > Enemyslime.coinflip == 1>>>

    > set toggle to <left>

    >

    > Enemyslime.coinflip == 2>>>

    > set toggle to <right>

    >

    > see if this starts choosing them better.

    >

    I see! I'll try when I get back, but do I need to put "round" in front of the random(1,3) so it doesn't choose decimals?

    yeah I forgot, floor(random())

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