Controlling Instances [SOLVED]

  • I have a sprite called "Attractor" instances of this sprite have been copied a number of times within a scene

    I have a sprite called "Bee" again with multiple instances.

    I want to give the attractors two states "on" and "off" - every 5 seconds I want the system to pick one attractor at random and to turn it to "on" while turning the others "off"

    At the same time, when an Attractor is "On" I want to tell the bees (which are physics objects) to apply force to the "On" Attractos position.

    Does this make sense?

    I can't figure it out. I don't know how to control different instances of the same object. Especially I don't know how to tell the Bees to move to the different instances of that same object.

  • its pretty easy

    example

  • Pretty simple:

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/beeeeees.png" border="0">

    beeeeees.capx (r110.2)

    ah too slow :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • haha yeah thats....pretty obvious.

    I've never used 'pick'

    Thanks guys :)

  • Gah I messed up

    So there's another complication. The player character, when the player character gets close to an attractor and the attractor is "on" - I need the bees add force towards the player.

    I've got distance(playerbase.X,playerbase.Y,attractor.X, attractor.y) to determine the distance but it seems to only apply to one of the attractors.

    Any ideas?

  • Scratch that, figured it out :)

    <img src="https://dl.dropbox.com/u/3317708/vlcsnap-2012-11-28-20h27m13s21.png" border="0" />

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