Picking question

  • I'm trying to pick a random object, from 50 objects, which has a certain variable set, but must NOT have another set.

    So I'm doing....

    Object Var1 = 1

    Object Var2 <> 2

    Pick a random Object.

    It's not working. It IS getting all the objects with var1 set to 1, but it's also occasionally grabbing objects where var2 = 2, which it shouldn't be doing?

  • Your logic seems correct to me. Post a capx?

  • Your logic seems fine. I've tried this:

    <img src="http://i47.tinypic.com/eq5sv8.png" border="0" />

    Every time you click a sprite the system adds one to the second variable.

    Then it picks every second a random instance within the given constraints.

    A touch outside resets the second variable of all instances.

    Have fun

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. I was wondering if there was something wrong with the logic of checking if a variable is NOT a certain number during the picking process, but if your example works, then I can't fathom why mine doesn't. It's still picking the variable which is not selected, maybe I have to indent the 'pick' command or something.

    * Worked this one, it was an error in my code thankfully, the variables were being reset elsewhere. Doh.

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