Private variables and animation timing

This forum is currently in read-only mode.
  • Hello - I'm trying to set up timed spikes, with a private variable as the delay time for each instance. My problem is that If I have multiple spikes on screen they all animate at the same time rather than to the time set by each private variable. They appear to just grab one of the private variables and apply that to the rest of the spikes. Perhaps there is something fundamental I am missing here, but I thought that the whole point of private variables was to add some distinction between instances that are essentially the same?

    <img src="http://www.masspanicmusic.com/stuff/spikes.jpg" border="0">

    .cap file here for anyone interested in taking a look

  • From what I can see, the problem is that You don't specify which instances private variable to use for the event. So it will just use the 'spiketime' variable of the the first created spikes Sprite.

    All You need to do is add the System Condition 'For Each Object' on top of both events. This will pick each instance and its own variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you. I discovered that I needed to put the wait object in a container with the spikes and it would work, but the For Each Object condition is very handy to know.

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