Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: rmonic79 on Sun 07/12/2014 21:07:11

Title: help about background object moving when dialogue start [SOLVED]
Post by: rmonic79 on Sun 07/12/2014 21:07:11
hi, i want to move clouds in background even when the dialogue is running, i did like this

Code (ags) Select
function room_RepExec()
{

if (IsTimerExpired(4)){ocloud.X=ocloud.X - 1;SetTimer(4, 20);}
if (IsTimerExpired(5)){ocloud1.X=ocloud1.X - 1;SetTimer(5, 20);}
}


but doesn't work during dialogue, the clouds stop moving :( i tried also with object.move but the speed is too much fast
any suggestion?
Title: Re: help about background object moving when dialogue start
Post by: abstauber on Sun 07/12/2014 22:02:03
For this you need to activate "Run game loops while dialog options are displayed". You'll find it in General Settings.

Then you need to add the function repeatedly_execute_always() manually to the script and add those cloud moving lines there

Code (ags) Select

function repeatedly_execute_always()
{
    if (IsTimerExpired(4)) {
        ocloud.X=ocloud.X - 1;
        SetTimer(4, 20);
    }

    if (IsTimerExpired(5)) {
        ocloud1.X=ocloud1.X - 1;
        SetTimer(5, 20);
    }
}
Title: Re: help about background object moving when dialogue start
Post by: rmonic79 on Sun 07/12/2014 22:10:59
Quote from: abstauber on Sun 07/12/2014 22:02:03
For this you need to activate "Run game loops while dialog options are displayed". You'll find it in General Settings.

Then you need to add the function repeatedly_execute_always() manually to the script and add those cloud moving lines there

Code (ags) Select

function repeatedly_execute_always()
{
    if (IsTimerExpired(4)) {
        ocloud.X=ocloud.X - 1;
        SetTimer(4, 20);
    }

    if (IsTimerExpired(5)) {
        ocloud1.X=ocloud1.X - 1;
        SetTimer(5, 20);
    }
}


Great :) i didn't know it can be added to room script i read about it but i thought it was obsolete.
works fine
Title: Re: help about background object moving when dialogue start [SOLVED]
Post by: Matti on Mon 08/12/2014 00:22:59
Btw:

Code (ags) Select

ocloud1.X = ocloud1.X - 1;


can be shortened to:

Code (ags) Select

ocloud1.X -= 1;
// or just
ocloud1.X --;