Issue with creating timers in the script editor
Posted: Sat Mar 15, 2014 9:30 pm
So, I have this code in the Global Code:
I call startsquad(0,0) in an actor.
It mostly works, but the timer's not working when I create it from the function. It works fine when I create it otherwise.
Please help
- Code: Select all
struct {
struct {
int xoffset;
int y;
int wait;
int end;
} movements[5];
int columns;
int waittime;
int enemytype;
int rows;
int untilnext;
} levels[5][5];
oid startsquad(int levelno, int squadno) {
Actor * view = getclone("view");
int c;
Actor * enemy;
int offint;
int r;
for (c = 0; c < levels[levelno][squadno].columns; c++) {
offint = view->width / (levels[levelno][squadno].columns + 1);
for (r = 0; r < levels[levelno][squadno].rows; r++) {
enemy = CreateActor("enemy", "enemy0", "(none)", "(none)", view->x + offint * (c+1),
levels[levelno][squadno].movements[0].y, true);
CreateTimer(enemy->clonename, "linetimer", levels[levelno][squadno].movements[0].wait * r);
}
}
}
I call startsquad(0,0) in an actor.
It mostly works, but the timer's not working when I create it from the function. It works fine when I create it otherwise.
Please help