Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Sun 24/04/2011 09:00:54

Title: Stop ShakeScreenBackground
Post by: barefoot on Sun 24/04/2011 09:00:54
Hi

When the player gets to a certain point I want to stop ShakeScreenBackground (which is in Rep Exe).. I have tried ShakeScreenBackground=false and also tried setting ShakeScreenBackground (4, 10, 0);
so it's length is 0 but to no avail..

It is set to happen after main player uses inventory and runs to point B where another character appears. An object stops animating up and down (thats ok) and then  ShakeScreenBackground supposed to stop. Afterwhich a dialog opens (thats ok)..

It mainly because it makes dialog harder to read when shake screening..

Here is my code from when an object stops animation (ok to this point)



// This bit runs ok

object[0].StopAnimating();

// Problem (says invalid perimeter)

ShakeScreenBackground (-2, 1, 0);

//  Runs ok from here

object[1].SetView(15);
object[1].Animate(0, 3, eRepeat, eNoBlock, eBackwards);
cwizard.SayAt(60, 66, 200,"That is my doing Magrid. I'm going to toy with you before you meet your doom!! I have a question for you!!!");
object[1].SetView(15);
cwizard2.FaceLocation(282, 144);

cwizard2.Say("Eh!!");
object[1].Animate(0, 3, eRepeat, eNoBlock, eBackwards);

cwizard.SayAt(60, 66, 230,"So, you've overcome my pressing contraption! Answer me this is you want to take a step closer to me Magrid! Get it wrong and I will send you back!!!");
object[1].SetView(15);
cwizard2.Say("Back???!! What is it you ask?");
object[1].Animate(0, 3, eRepeat, eNoBlock, eBackwards);

cwizard.SayAt(60,66,230,"You are in a cold house in the winter. It is dark. You have one match. There is a candle and there is a wood burning stove. Which do you light first?");
object[1].SetView(15);

 dquestion1.Start();


Any hints...

barefoot

Title: Re: Stop ShakeScreenBackground
Post by: TomatoesInTheHead on Sun 24/04/2011 10:19:17
-2 is not a valid delay parameter, 2 is the minimum.

I see how one can be easily confused by the manual here:
Quote from: ManualDELAY specifies the 'shakiness' of the shake - 2 is the lowest you can pass for this, and will create the most shaky screen.
Looks like it says "-2", but that's actually a dash in the sentence. Maybe that dash would better be changed to a semicolon or something.

But ShakeScreenBackground(..., ..., 0) will not work to end a screenshake if you start it again in every gamecycle with RepExec, you have to (additionally) use some flag there to not start it again.

something along the lines of

//above rep_ex and other function
bool isShaking = true;

//in rep_ex
if (isShaking)
 ShakeScreenBackground(4, 10, 40); //shake it another second

//in the function that stops the shaking
isShaking = false;
ShakeScreenBackground(4, 10, 0); //stop current shake
Title: Re: Stop ShakeScreenBackground
Post by: barefoot on Sun 24/04/2011 10:53:39
Hi

yes, should be:

DELAY specifies the 'shakiness' of the shake. 2 is the lowest you can pass for this, and will create the most shaky screen.

Bool true/false seems the way..

Anyhow, thanks a lot TomatosInTheHead

barefoot