#45243 - Ultima2876 - Wed Jun 08, 2005 11:58 pm
Is there any good way I can shake the screen using windows or some other method? I wanna make an earthquake type effect, and changing the scroll registers really wouldn't work too well because th sprites wouldn't move... I suppose I could go through changing all the X/Y positions of the sprites (and collisions) too, but obviously if there's a way using something like windowing I'd like to know. Thanks very much.
#45245 - poslundc - Thu Jun 09, 2005 12:13 am
Windows only determine what regions visual elements are displayed in, not where those elements are located. You will have to iterate through your sprites and offset them. Which really shouldn't be a very big deal.
Dan.
#45246 - ScottLininger - Thu Jun 09, 2005 12:28 am
Well, here's a possible trick, but it's hard to explain.
If you swap out the screen mode during an hblank, the entire screen will be redrawn starting from the line you are hblanked on. This is a way of "virtually" scrolling the entire screen up and down, sprites and all.
So let's say that you're using Mode0 for your game. If you want to "shake" the screen vertically, you could do something like this:
Code: |
void HBLANK(void)
{
// shakeOffsetY would be set randomly each frame
// to provide the "shake" effect. A value between 0 and 5
// would probably look okay
if (REG_VCOUNT >= shakeOffsetY )
{
// set the "standard" game mode
SetMode(MODE_0 | BG3_ENABLE | OBJ_ENABLE | OBJ_MAP_1D);
}
else
{
//set some other mode
SetMode(MODE_3);
}
} |
If combined with some background scroll registers, this would probably be pretty convincing. The sprites wouldn't shake side to side, but they would shake vertically.
I used this "multiple modes in a single frame" trick to create a mode0 RPG game area on top of the screen and a mode3 dialog area on the bottom, and it was stable under emulation and hardware.
Cheers,
-Scott
#45331 - Ultima2876 - Thu Jun 09, 2005 6:01 pm
Scott,
It doesn't seem to work... it doesn't start drawing from the beginning when you set the mode to 0, it starts drawing from whatever scanline it is on, so that wouldn't cause the screen to shake, it would just cause the top few scanlines to not be drawn x.x