Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Sparkiller on Sun 29/07/2012 09:59:13

Title: Wait function stops background object movement
Post by: Sparkiller on Sun 29/07/2012 09:59:13
Hi everyone!

For the intro of my current project i'm trying to have a background of moving stars (via object and room_RepExec), while the Text (overlay in room_AfterFadeIn) displays in front of it.
The Move-function in room_load works fine, but using the Wait-function seems to interrupt/stop the background loop and i can't figure out why. Here is the code i'm using:

room_load:
Code (AGS) Select
oStarsHor.Move(0, 200, 1, eNoBlock, eAnywhere);

room_RepExec:
Code (AGS) Select
if (oStarsHor.Y == 200) {
oStarsHor.Y = 600;
oStarsHor.Move(0, 200, 1, eNoBlock, eAnywhere);
}


room_AfterFadeIn:

Code (AGS) Select
Wait(180);
Overlay* myOverlay = Overlay.CreateTextual(50,80,300,5,11,"Blah blah blah");
Wait(160);
myOverlay.SetText(0,Game.SpeechFont,15,"");
Wait(80);
myOverlay.SetText(300,5,11,"Blah blah blah");
Wait(160);
etc. etc.


Thanks in advance!
Title: Re: Wait function stops background object movement
Post by: Alan v.Drake on Sun 29/07/2012 10:19:54
room_RepExec is subsceptible to block functions, use repeatedly_execute_always() instead (you don't need to link it to the room events).

- Alan
Title: Re: Wait function stops background object movement
Post by: Sparkiller on Sun 29/07/2012 12:52:44
Quote from: Alan v.Drake on Sun 29/07/2012 10:19:54
room_RepExec is subsceptible to block functions, use repeatedly_execute_always() instead (you don't need to link it to the room events).

That solved it! Thank you for your fast response!