Private variables and animation timing

For questions about using Classic.

Post » Mon Jan 30, 2012 3:01 am

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?


.cap file here for anyone interested in taking a look
B
46
S
16
G
3
Posts: 133
Reputation: 4,955

Post » Mon Jan 30, 2012 10:41 am

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.
B
3
G
1
Posts: 70
Reputation: 615

Post » Tue Jan 31, 2012 1:37 am

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.
B
46
S
16
G
3
Posts: 133
Reputation: 4,955


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests