Let's improve scrolling together! [4.5.9] (dohandlecamera updates/fixes)

crazygrouptrio

Active member
If I understood your problem correctly, then try this fix
Code:
doUpdateCamera:

    LDX camObject
   
    LDA Object_h_speed_lo,x
    STA tempA
    LDA Object_h_speed_hi,x
    STA tempB
   
    LDA camX
    AND #%11110000
    STA tempz

    LDA scrollByte
    AND #%10100000
    BNE +scrollEngaged
        JMP skipScrollUpdate
+scrollEngaged:

    LDA scrollByte
    AND #%10000000
    BNE doHorizontalCameraUpdate
   
    ;;;;;;;;;;;;;;;;;;;;Fix for black column appearing after death. Commented out JMP line and added RTS
         RTS
        ;JMP noHorizontalCameraUpdate
           ;;;;;;;;;;;;;;;;;;
Code:
doRightCameraUpdate:
        LDA camX_lo
        clc
        adc tempA
        STA camX_lo
        LDA camX
        adc tempB
        STA temp
            BCS +skipCheckForScrollScreenEdge
                LDA ScreenFlags00
                AND #%00010000
                BEQ +skipCheckForScrollScreenEdge
                       
    ;;;    Fix for black column appearing after death. Commented out JMP line and added RTS
                 ;JMP noHorizontalCameraUpdate     ;;;
                  RTS
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Thank you, this fixed it! I thought this fix was already implemented so I didn't think of it, my bad.
 

kbogle

Member
Having a new issue after I updated to this script. Scrolling works but now my go to next screen is acting up. When I hit the right boundary it takes me to the next screen on the right. However, now sometimes when I hit the left boundary it just scrolls right instead of taking me to the next left screen. Does anyone else having this issue?
 

baardbi

Well-known member
Having a new issue after I updated to this script. Scrolling works but now my go to next screen is acting up. When I hit the right boundary it takes me to the next screen on the right. However, now sometimes when I hit the left boundary it just scrolls right instead of taking me to the next left screen. Does anyone else having this issue?
Yes. That's a known issue. The scrolling platform modules doesn't really handle going past the left or right edge for scroll. I made a tutorial for this. It's not perfect, but it's the closest I have come to solving this issue so far.

 

kbogle

Member
Yes. That's a known issue. The scrolling platform modules doesn't really handle going past the left or right edge for scroll. I made a tutorial for this. It's not perfect, but it's the closest I have come to solving this issue so far.

Thank you very much!
 
A small tip
I have "Arcade-base style" No-scrolling-screens / one-screen only, tutorial and bonus rooms at some places in my scrolling game.
I had both right and left flags checked for those rooms but sometimes when warping into them the screen gets a row of tiles currupted.

I dont know if it is because the player is starting to run while warping in or if it is the camera trying to correct it self
depending on player warp in position, or something else..

I used screenflag 4 to skip the camerahandeler script for those screens and the problem went away.

Added this code to the top of the camerahandeler:

Code:
LDA ScreenFlags00
AND #%00001000 ; this is a screen with no scrolling
BEQ +doTheScrolling
    RTS
+doTheScrolling:
 

baardbi

Well-known member
I was experimenting a little bit with mixing platform and shooter gameplay. The autoscroll works great for the shooter stages, but I always had a problem with the player being scrolled along with the screen. I constantly had to move right to make sure he didn't scroll off screen to the left. I wanted something more like the shooter module, where the player is constantly on the screen (even if you don't touch the D-pad). I added this code to the physics script, and it seems to work great. I haven't tested it extensively, but so far it seems to work fine.

I added this right below skipPhysics:

Code:
;;; Don't auto scroll player object
CPX player1_object
BEQ +isPlayer
    JMP +notPlayer
+isPlayer:
    LDA ScreenFlags00
    AND #%00000010 ;;; Auto scroll
    BNE skipAutoScrollForPlayer
        JMP +notPlayer
    skipAutoScrollForPlayer:
        LDA xHold_lo
        CLC
        ADC #$00
        STA xHold_lo
        LDA xHold_hi
        ADC #$01;; this becomes the "SCROLL SPEED" - it is the offset at which the player moves.
                ;; in conjunction with camera speed update, this could make it scroll faster.
        STA xHold_hi
        LDA xHold_screen
        ADC #$00
        STA xHold_screen
+notPlayer:
 

SciNEStist

Well-known member
I was experimenting a little bit with mixing platform and shooter gameplay. The autoscroll works great for the shooter stages, but I always had a problem with the player being scrolled along with the screen. I constantly had to move right to make sure he didn't scroll off screen to the left. I wanted something more like the shooter module, where the player is constantly on the screen (even if you don't touch the D-pad). I added this code to the physics script, and it seems to work great. I haven't tested it extensively, but so far it seems to work fine.

I added this right below skipPhysics:

Code:
;;; Don't auto scroll player object
CPX player1_object
BEQ +isPlayer
    JMP +notPlayer
+isPlayer:
    LDA ScreenFlags00
    AND #%00000010 ;;; Auto scroll
    BNE skipAutoScrollForPlayer
        JMP +notPlayer
    skipAutoScrollForPlayer:
        LDA xHold_lo
        CLC
        ADC #$00
        STA xHold_lo
        LDA xHold_hi
        ADC #$01;; this becomes the "SCROLL SPEED" - it is the offset at which the player moves.
                ;; in conjunction with camera speed update, this could make it scroll faster.
        STA xHold_hi
        LDA xHold_screen
        ADC #$00
        STA xHold_screen
+notPlayer:
a good addition. I did address something like this in an earlier post HERE that would adjust the player speed to match the camera speed, no matter what it's set to
 
Top Bottom