Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Angelo Caprio on Thu 19/04/2012 12:11:29

Title: Shake screen while moving
Post by: Angelo Caprio on Thu 19/04/2012 12:11:29
Hi I'm making a new game I want in one part of my game there is a earthquake
and I want the screen to shake, but still make the player able to walk when clicked ???

You don't have to give me the script if there is.... otherwise just point me in the right direction anyway will be appreciated
 
 Sorry if I had some spelling mistakes I'm 14
   
   by the way if this is supposed to be posted in the beginners section let me know and sorry if it should :D
Title: Re: Shake screen while moving
Post by: Khris on Thu 19/04/2012 12:34:53
You can shake the screen manually using the SetViewport() command.

Say your game is 320x200 and you have a room that's three screens wide (960x200). What you do is make the background a few pixels taller, say 960x210, then use manual scrolling for the viewport's x position and during the earthquake, also change the y position.

You will also need the repeatedly_execute_always function.

(Btw, your spelling is fine, using punctuation couldn't hurt though ;))
Title: Re: Shake screen while moving
Post by: ThreeOhFour on Thu 19/04/2012 12:52:18
Another option would be to use the ShakeScreenBackground() function. This shakes the screen without pausing the game, meaning it can still be played.
Title: Re: Shake screen while moving
Post by: Khris on Thu 19/04/2012 14:23:39
Oops. Didn't know about that one.
On the other hand, the ShakeScreen functions cause slight graphical glitches, as in, the area of the screen revealed by shaking the screen is a copy of the top part of the screen, not a previously not visible part of a scrolling background. But that may also have been fixed by now.
Title: Re: Shake screen while moving
Post by: ThreeOhFour on Thu 19/04/2012 15:25:38
I don't think it has been fixed, and if you are doing it for an extended period of time the issue may be a problem. Still, it's the easiest way of getting this to work if you can overlook the glitch (I usually can).
Title: Re: Shake screen while moving
Post by: Angelo Caprio on Thu 19/04/2012 16:18:49
Thank's I really appreciate the reply both ways works fine for me ;D
 Kinda new to AGS working with it for a year and still learning.

I made so many games but have only finished one the reason is that I hate and I mean HATE drawing >:(
currently busy with a game called Jimmy Spock... and this Time I will, I repeat I WILL FINISH IT.