The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 ViewsOk so, I have a button that when clicked opens up the floor and the object that was on the floor falls. It works right now because I only have on object on the floor but I want to add more. Eventually I want the player to be able to add more objects just by clicking a button and then when the floor is opened, all objects there will fall through.
So I took that one instance of the object that was on the stage and copy pasted it a couple of times. Now when i click the fall button all of the objects fall but only one of them plays the falling animation I added. Is there a way I can make it so no matter how many instances of the object there are on the stage, they will all fall and play the falling animation when the button is clicked?
Here is the code that is on the floorMC which contains the button:
on(release) {
this.gotoAndPlay(3);
_root.teddy.gotoAndPlay("fall");
}
Any help is greatly appreciated, thank you!
AS: Main
Don't read this sentence.
You can't have multiple movie clips with the same instance name. Try something like:
on(release) {
this.gotoAndPlay(3);
for (i = 0; i < insertnumberhere; i++ ) {
_root["teddy"+i].gotoAndPlay("fall");
}
}
Untested, but nevertheless, you can try solving this by adding a for loop, then changing the instance name 'teddy' for all of the movie clips by renaming them 'teddy1', 'teddy2', etc...
postcount +=1;
Newgrounds Photoshop Headquarters || Don't use MS Paint! Use Aviary!
SING US A SING YOU'RE THE PIANO MAN
Ok, I think I get what you're saying. Let me try this out.
Thanks!
AS: Main
Don't read this sentence.