Remove doubling up on Screen Shake?

Started by Sughly, Fri 11/11/2011 03:37:16

Previous topic - Next topic

Sughly

Hey, once again I'm pretty sure this has an easy solution that I'm just not seeing, but when I use ShakeScreenBackground it gets this kind of doubling up effect that looks a bit crap.

Example


So when the screen is shaking down, there's still a copy of the pic in the normal position behind it. I've tried random things like capturing the screen, changing the background to black and shaking the screen then, but it still ends up doing the same thing. My preference obviously is to just have black across the top when the screen shakes downwards.

steptoe


Posting the ShakeScreenBackground script you're using may help..


Sughly

Ah yes, good point  8)

Actually it most likely has something to do with my funky scripting. I'm doing a slow fade to white as the shaking increases and the sfx for the shake gets louder:

Code: ags
while (whiteFade>0){
      whiteFade--;
      sfxFade++;
      SFX.Volume = sfxFade;
      oWhite.Transparency = whiteFade;
      shakeCount++;
      if (scrShake<15){
        if (shakeCount==5){
          scrShake++;
          shakeCount=0;
        }
      }
      ShakeScreenBackground(4, scrShake, 5);
      Wait(5);
    }


Anyone see where I've gone wrong?

Khris

#3
I'm pretty sure this is an engine issue. I don't think it can be mitigated or avoided by surrounding code; it's caused by the command itself.
I've seen this in a lot of games that used shaking, unfortunately.

Gilbert

Unfortunately this is how the function is implemented. I have thought of two workarounds that may make it slightly better:
1. Manually add black bars on the top and bottom during the shake (can be done with Overlays, GUI, etc.). This may add dramatic effect if desired. I have done a quick test with a 320x240 room with the following codes:
Code: ags

DynamicSprite* ds=DynamicSprite.Create(320, 20);
DrawingSurface* sur=ds.GetDrawingSurface();
sur.Clear(16);
sur.Release();
Overlay* ol0=Overlay.CreateGraphical(0, 0, ds.Graphic, false);
Overlay* ol1=Overlay.CreateGraphical(0, 220, ds.Graphic, false);
Wait(1);
ShakeScreen(10);
ol0.Remove(); ol1.Remove(); ds.Delete();  

2. Make the rooms that would be shaken slightly larger than the screen, and script it so that when you want to shake it you instead change the Viewport slightly in each game loop (i.e. scrolling) to create a shaky effect.

Sughly

Ah I thought that also might have been the case. I tried something similar to your first option Iceboty but I didn't do a very good job of it. Might try this suggestion instead! Thanks guys for getting back to me!  ;D

SMF spam blocked by CleanTalk