About Picking

0 favourites
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Ashley, is Pick by Comparison to far ahead ? Would greatly facilitate things for my game. If it wont be coming anytime soon any idea of how do i simulate it ?

  • A little bit of info:

    System: abs(player.x-enemy.x) < distance

    That only compares the first picked "player" and "enemy" objects' values.

    foreach enemy
    System: abs(player.x-enemy.x) < distance

    This compares each enemy against the first picked instance of the player.

    enemy: abs(player.x-enemy.x) < distance

    Now the "pick by comparison" that CC has is like the "system compare" with these differences:

    1. Corresponding picked instances are used for expression values.

    ex:

    The first picked enemy is compared with the first picked player,

    the second with the second,

    the third with the third... and so forth.

    If the amount of picked objects differ in count for example: 2 players and 4 enemies it will loop back to the first.

    ex:

    The first picked enemy is compared with the first picked player,

    the second with the second,

    the third with the first,

    and the fourth with the second.

    2. The enemy objects are picked.

    I'd also like to point out these apply to picking in general with most object conditions.

    Now for the workarounds until "pick by comparison" is added.

    Since I assume there will be one player and many enemies Yann's second solution will work fine. I've also used private variables to do the same thing:

    Every Tick-> enemy: set dist to abs(player.x-enemy.x)

    enemy: dist < distance -> do stuff

  • Yeah creating a dist variable should be more adequate to my events.To use Yann's solution i'd have to use an 'OR' for my particular case. I'll go this way for now. Yet Pick by Comparison would be very welcome. I hope C2 will be on par with Classic at least on non graphical things soon. Thanks R0J0hound.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well found the origin of my problems:

    I had

    -Enemy.isSomething -> Jump

    -Trigger Once

    What was happening : When one enemy triggered the if once, it wouldn't trigger again for any other enemy. I had trigger once on animations too. When i removed them all it all worked perfectly. Very strange.

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