Rather than use Simon's rather complicated code, I have been trying to implement the viewport mode by a simple function to either turn the mode on or off in horizontal mode and then including a status check of a separate object, so that if the status is 1 then the vertical mode is also turned on.
I have an odd situation that I can't explain. Imagine three rooms in a row. Rm 1 has the horizontal vewport on. Rm2 has the horizontal and vertical viewport turned off. Rm 3 has the horizontal and vertical viewport on.
Moving from rm 1 to rm 2 and back again is fine. Moving from rm 2 to rm 3 and back again is fine. But going back to rm 1 from rm 2 after having been in rm 3 the room's y axis is offset by 24 pixels so that the bottom of the upper room is showing as part of the 'current' room. This oddity then remains the default for moving to any other room with the horizontal viewport on - even though it switches back to the proper view when in any room with viewport mode turned off, but switches back to the odd view when entering another room with viewport mode on (either horizontal only or horizontal and vertical mode on).
I have no idea why on earth this is happening. Can anyone point me towards somewhere to try and fix this?
viewport mode acting silly
- Noggin the Nog
- Hard Boiled Egg
- Posts: 431
- Joined: Sun Jul 01, 2012 12:04 am
Re: viewport mode acting silly
This rings a faint bell. I'll have a think about it. 

-
- Hard Boiled Egg
- Posts: 1512
- Joined: Sat Aug 08, 2009 10:47 am
- Location: Balham - gateway to the south
Re: viewport mode acting silly
Thanks Simon. I just deleted the vertical scrolling code in Property Ladder Dizzy with no problem. I checked Colin's 'Pirate life Dizzy' as he also used status checks for horizontal and vertical scrolling with no problem. Can't find anything in the GS9 book, just a description of the code.
As a different check I used different objects' status for horizontal and vertical scrolling and turned both off and set viewportmode off when going back to rm 2 from rm 3 and then turned horizontal status and viewportmode back on when going from rm 2 to rm 1 ...but still get the 'dip' in the room view going back to rm 1 after having entered rm 3,
I really feel that turning the viewportmode off and resetting the status checks back to zero should reset the handler, so all digits crossed that your memory won't fail you.
Thanks, Steve
As a different check I used different objects' status for horizontal and vertical scrolling and turned both off and set viewportmode off when going back to rm 2 from rm 3 and then turned horizontal status and viewportmode back on when going from rm 2 to rm 1 ...but still get the 'dip' in the room view going back to rm 1 after having entered rm 3,
I really feel that turning the viewportmode off and resetting the status checks back to zero should reset the handler, so all digits crossed that your memory won't fail you.
Thanks, Steve

- Noggin the Nog
- Hard Boiled Egg
- Posts: 431
- Joined: Sun Jul 01, 2012 12:04 am
Re: viewport mode acting silly
Hi Steve,
I remembered where I'd seen this before. In AndyG's demo - The Legend of Daisy, there's a bit where you fall down a shaft and it scrolls vertically, then it goes back to horizontal scrolling, but afterwards the viewport is slightly misaligned, so that there's a 4 pixel gap at the bottom of the screen.
I had a fiddle and you can fix it by setting G_VIEWPORTY to zero. Andy used a collider at the bottom of the shaft to change the scrolling so I just added an extra line to the CollideObject function.
Maybe this will fix your problem too?
I remembered where I'd seen this before. In AndyG's demo - The Legend of Daisy, there's a bit where you fall down a shaft and it scrolls vertically, then it goes back to horizontal scrolling, but afterwards the viewport is slightly misaligned, so that there's a 4 pixel gap at the bottom of the screen.
I had a fiddle and you can fix it by setting G_VIEWPORTY to zero. Andy used a collider at the bottom of the shaft to change the scrolling so I just added an extra line to the CollideObject function.
Maybe this will fix your problem too?
-
- Hard Boiled Egg
- Posts: 1512
- Joined: Sat Aug 08, 2009 10:47 am
- Location: Balham - gateway to the south
Re: viewport mode acting silly
Thanks so much Simon ...just adding GameSet(G_VIEWPORTY, 0); sorted it out perfectly. There's only going to be a few 'sections' where vertical scrolling is required, so this tiny little line of code should stop me getting any more big dents in my computer table and large bumps on my head 
