My two main problems I'll need to address: 1. After the sanctuary, the scrolling screens seem to all shift a few pixels up! I have no idea why. It's most noticeable in the graveyard, although you can't see the difference because you can't access it beforehand. 2. Parallax scrolling seems to only work twice for me and then no more. Again, no idea why. {dizzy}:huh:
Hey Andy, I've had a little look your code. With the scrolling, the problem stems from the bit where you turn on the vertical scrolling when Dizzy falls down the shaft by Zaks' castle. The simplest way to fix it is to add this line to the AfterUpdate Handler:
if( GameGet(G_VIEWPORTMODE)==2 )
{
GameSet( G_VIEWPORTY, GameGet(G_ROOMY)*roomh - PlayerGet(P_Y) + roomh/2 );
}
[color="#FF0000"]else GameSet( G_VIEWPORTY,0);
With the parallax scrolling, I'm using a slightly different technique in my new game, which is less prone to bugs. This is how it works:
plx = PlayerGet(P_ X) ;
diffx = (plx - [color="#FF0000"]832)/4;
castx = diffx*3;
bgd = ObjFind(60);
xpos = ObjGet(cgd,O_ X) ;
ObjSet(bgd,O_X,[color="#FF0000"]608 + castx);
ObjPresent(bgd);
832 is the player's starting position, and 608 the position of the background tile on the map. You don't actually have to use the starting positions, the idea is just that when dizzy is at x = 832, the left side of the backdrop is at x = 608. The code then moves the backdrop relative to those positions.
The other thing I'd advise you to do, for simplicity's sake, is to have all the backdrops moving together. So don't try and turn their movement on and off using if(GameGet(G_ROOMY)... ) or whatever. Instead, disable or enable the objects when you move from area to area. So, when you enter the graveyard, enable the graveyard backdrop and disable all the others. That way, the scrolling code can just be a simple list like so:
plx = PlayerGet(P_ X) ;
diffx = (plx - 832)/4;
castx = diffx*3;
bgd = ObjFind(60);
xpos = ObjGet(cgd,O_ X) ;
ObjSet(bgd,O_X,608 + castx);
ObjPresent(bgd);
diffx = (plx - 1248)/4;
castx = diffx*3;
bgd = ObjFind(61);
xpos = ObjGet(cgd,O_ X) ;
ObjSet(bgd,O_X,1024 + castx);
ObjPresent(bgd);
etc. etc...
This will keep the code simple and it'll be easier to tell where you've made a mistake. Trust me, I found this out the hard way myself!