Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Technocrat on Sun 24/10/2010 15:12:29

Title: Objects stop moving when characters talk.
Post by: Technocrat on Sun 24/10/2010 15:12:29
Right now, as a background effect, I've got a number of objects, that move down across the screen (like the "code rain" effect in the matrix"). Essentially, hey do this by increasing their "y" value every cycle, and when they reach a certain value (the bottom) they move back up to the top and begin again. This is all well and good, except that I've found when somebody says anything, all of the objects freeze still. I assumed that this was because the speech was blocking the rain from dropping.

Is there a better means you could suggest to make 30 or so objects move like this, or am I going to have to build characters instead and get them to "walkstraight" in the background?
Title: Re: Objects stop moving when characters talk.
Post by: Scavenger on Sun 24/10/2010 15:18:40
Are you putting the Y value changes in repeatedly_execute, or repeatedly_execute_always?

The latter is what you want for a constant, do-even-when-blocking effect. It isn't in the main script afaik on empty games, so just add it in there:

function repeatedly_execute_always () {
//Put code here.
}


If it's just a room-only thing, put it in the room script.
Title: Re: Objects stop moving when characters talk.
Post by: monkey0506 on Sun 24/10/2010 19:01:15
Just to clarify what Scavenger said, repeatedly_execute_always is the way to go, and it can be added to any ASC script file (GlobalScript.asc, roomX.asc, and/or any module script files). It doesn't have to be linked in the editor anywhere, it will be called automatically if it exists in the script, even while blocking events, like speech, are running.
Title: Re: Objects stop moving when characters talk.
Post by: Technocrat on Mon 25/10/2010 08:47:39
Ah, I hadn't heard of repeatedly_execute_always. That sounds like exactly the kind of thing I'm looking for! Much obliged!
Title: Re: Objects stop moving when characters talk.
Post by: johanvepa on Fri 21/03/2014 22:13:27
I'm trying to create a rain effect and saw this post. Could you specify for me, how do you increase x and y values so the object moves?
Title: Re: Objects stop moving when characters talk.
Post by: Khris on Sat 22/03/2014 18:16:52
oRain.Y++;
will move the object one pixel down.
Title: Re: Objects stop moving when characters talk.
Post by: johanvepa on Sat 22/03/2014 20:59:56
Quote from: Khris on Sat 22/03/2014 18:16:52
oRain.Y++;
will move the object one pixel down.

So simple! I love it when things are simple. Thank you Khris.