Ã, Hi guys,
Ã, I started making a game with AGS a while ago and I find it great fun. But I came across a big problem. I started working on an arcade room in which the player would guide a boat up a river, and a crocodile was supposed to appear and swim down the screen.
Ã, So I used the script I found in the ‘Arcade Driving room' of the Demo Game, and put this in my room script for the crocodile character:
Ã, // script for room: Repeatedly execute
if (IsTimerExpired(1)) { // croc
character[CROC].x = 180;
character[CROC].y = 94;
Ã, croc = Random (2);
Ã, if (croc==0) {
Ã, MoveCharacterDirect (CROC,81,260);
Ã, }
Ã, else if (croc==1) {
Ã, MoveCharacterDirect (CROC,81,260);
Ã, }
Ã, else if (croc==2) {
Ã, MoveCharacterDirect (CROC,101,260);
Ã, }
Ã, timer1 = Random (3);
Ã, if (timer1==0) {
Ã, SetTimer (1,230);
Ã, }
Ã, else if (timer1==1) {
Ã, SetTimer (1,230);
Ã, }
Ã, else if (timer1==2) {
Ã, SetTimer (1,270);
Ã, }
Ã, else if (timer1==3) {
Ã, SetTimer (1,300);
Ã, }
}
But the thing simply won't work. I think that the problem is with the SetTimer function, which doesn't work in ‘Repeatedly execute' part of the script. The program seems to be working too fast for the function to be performed. It seems that SetTimer works only when I put it in ‘before fadein' part of the script.
Ã, How can I make SetTimer work in ‘Repeatedly execute'?
Ã, Is there any other routine I can use to make the croc appear at different intervals?
Ã, I started making a game with AGS a while ago and I find it great fun. But I came across a big problem. I started working on an arcade room in which the player would guide a boat up a river, and a crocodile was supposed to appear and swim down the screen.
Ã, So I used the script I found in the ‘Arcade Driving room' of the Demo Game, and put this in my room script for the crocodile character:
Ã, // script for room: Repeatedly execute
if (IsTimerExpired(1)) { // croc
character[CROC].x = 180;
character[CROC].y = 94;
Ã, croc = Random (2);
Ã, if (croc==0) {
Ã, MoveCharacterDirect (CROC,81,260);
Ã, }
Ã, else if (croc==1) {
Ã, MoveCharacterDirect (CROC,81,260);
Ã, }
Ã, else if (croc==2) {
Ã, MoveCharacterDirect (CROC,101,260);
Ã, }
Ã, timer1 = Random (3);
Ã, if (timer1==0) {
Ã, SetTimer (1,230);
Ã, }
Ã, else if (timer1==1) {
Ã, SetTimer (1,230);
Ã, }
Ã, else if (timer1==2) {
Ã, SetTimer (1,270);
Ã, }
Ã, else if (timer1==3) {
Ã, SetTimer (1,300);
Ã, }
}
But the thing simply won't work. I think that the problem is with the SetTimer function, which doesn't work in ‘Repeatedly execute' part of the script. The program seems to be working too fast for the function to be performed. It seems that SetTimer works only when I put it in ‘before fadein' part of the script.
Ã, How can I make SetTimer work in ‘Repeatedly execute'?
Ã, Is there any other routine I can use to make the croc appear at different intervals?