help about background object moving when dialogue start [SOLVED]

Started by rmonic79, Sun 07/12/2014 21:07:11

Previous topic - Next topic

rmonic79

hi, i want to move clouds in background even when the dialogue is running, i did like this

Code: ags
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?

abstauber

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

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);
    }
}

rmonic79

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

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

Matti

Btw:

Code: ags

ocloud1.X = ocloud1.X - 1;


can be shortened to:

Code: ags

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


SMF spam blocked by CleanTalk