Setting velocity to all clones
Posted: Mon Sep 30, 2013 9:32 pm
I'm still a beginner so maybe this is something very easy but I don't know how to fix. I took a look at some topics about clones but I couldn't understand many things, and what I could understand didn't help me. Here is what I did:
At the beginning of me game there is a buttom the executes the following code when you click it:
So now I have a start button and many balls on the screen (in this case, just two). Everything is motionless. Like this:
http://img534.imageshack.us/img534/3900/k7oa.jpg
But what I want is to command all the balls to start moving only when I press the Start Button (ob1start). So I added a Mouse Button Down event to this start button, and used the script editor like this:
This works fine for me when I'm dealing with different actors, because I only need to add this kind of commands to each one in the same script. But in this case, because I created two copies of the same actor on the screen, only the first one moves, and the other remains still. Like I said, I'm a beginner so I don't even know if what I did is the same as creating clones.
But most importantly, is there a command to make all those copies move at once? (I don't mind if the velocity of them all is the same or is different, I just need all of them to move when I press the button).
Here is a copy of the ged file:
http://depositfiles.org/files/aivck0zh1
Thanks
At the beginning of me game there is a buttom the executes the following code when you click it:
- Code: Select all
//This destroys the button I just used
DestroyActor("BotaoOb1");
//This creates a new start button
CreateActor("ob1start", "start", "(none)", "(none)", 400, 150, true);
//This is where I create many copies of the same actor, called "ob1vermelha", in different places on the screen. Those actors are balls.
CreateActor("ob1vermelha", "ob1 bola vermelha", "(none)", "(none)", -400, -200, true);
CreateActor("ob1vermelha", "ob1 bola vermelha", "(none)", "(none)", -350, -200, true);
So now I have a start button and many balls on the screen (in this case, just two). Everything is motionless. Like this:
http://img534.imageshack.us/img534/3900/k7oa.jpg
But what I want is to command all the balls to start moving only when I press the Start Button (ob1start). So I added a Mouse Button Down event to this start button, and used the script editor like this:
- Code: Select all
ob1vermelha.xvelocity = +2;
This works fine for me when I'm dealing with different actors, because I only need to add this kind of commands to each one in the same script. But in this case, because I created two copies of the same actor on the screen, only the first one moves, and the other remains still. Like I said, I'm a beginner so I don't even know if what I did is the same as creating clones.
But most importantly, is there a command to make all those copies move at once? (I don't mind if the velocity of them all is the same or is different, I just need all of them to move when I press the button).
Here is a copy of the ged file:
http://depositfiles.org/files/aivck0zh1
Thanks