Objects stop moving when characters talk.

Started by Technocrat, Sun 24/10/2010 15:12:29

Previous topic - Next topic

Technocrat

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?

Scavenger

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:

Code: ags
function repeatedly_execute_always () {
//Put code here.
}


If it's just a room-only thing, put it in the room script.

monkey0506

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.

Technocrat

Ah, I hadn't heard of repeatedly_execute_always. That sounds like exactly the kind of thing I'm looking for! Much obliged!

johanvepa

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?

Khris

oRain.Y++;
will move the object one pixel down.

johanvepa

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.

SMF spam blocked by CleanTalk