view->Create Actor->Script Editor
- Code: Select all
int i;
for (i = 1; i <= 5; i++) {
CreateActor("player", "square", "no parent", "no path", 200, 200, true);
MoveTo("player", i*10, i*10, 10, "Game Center", "");
}
Why it doesn't work?
Thanks!
int i;
for (i = 1; i <= 5; i++) {
CreateActor("player", "square", "no parent", "no path", 200, 200, true);
MoveTo("player", i*10, i*10, 10, "Game Center", "");
}
int i;
for (i = 1; i <= 5; i++) {
Actor* clone = CreateActor("player", "square", "no parent", "no path", 200, 200, true);
MoveTo(clone->clonename, i*10, i*10, 10, "Game Center", "");
}
for(i = 0; i < 5; i++)
MoveTo(cloneName, (i + 1)*10, (i + 1)*10, 10, "Game Center", "");
bat78 wrote:So your code will look like this:
- Code: Select all
int i;
for (i = 1; i <= 5; i++) {
Actor* clone = CreateActor("player", "square", "no parent", "no path", 200, 200, true);
char cloneName [32];
sprintf(cloneName, clone.clonename);
MoveTo(cloneName, i*10, i*10, 10, "Game Center", "");
}
lcl wrote:bat78 wrote:So your code will look like this:
- Code: Select all
int i;
for (i = 1; i <= 5; i++) {
Actor* clone = CreateActor("player", "square", "no parent", "no path", 200, 200, true);
char cloneName [32];
sprintf(cloneName, clone.clonename);
MoveTo(cloneName, i*10, i*10, 10, "Game Center", "");
}
Except the sprintf line should be clone->clonename, because you're dealing with a pointer.
koala wrote:Thank you very much!
Can I use strcpy() instead of sprintf()?
Users browsing this forum: No registered users and 1 guest