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

baardbi

Well-known member
I don't know if I'm doing something wrong here, but I'm having an issue with auto scroll left. It seems like the screen info for the screen to the left is loaded instead of the screen the player is on. So I have to set up auto scroll and right edge on the screen to the left of my player start screen. Is this a known issue, or am I maybe doing something wrong?
 

SciNEStist

Well-known member
it looks like you are correct, when going right, it waits till the screen is centered before jumping to the next settings, but when going left it changes as soon as the previous screen comes into view. ill look into thi issue, but for now as long as you are aware of the issue, you can adjust for it.
 

baardbi

Well-known member
Let me start by saying that I absolutely love the newcamerahandler. It's now part of my default NESmaker setup. But I have a question for you. I am having a problem with screen triggers. They only work on even screens. On odd screens the screen is already triggered when it loads. So screens on the X column (on the map) where X is 3, 5 ,7 etc. do not work. I'm trying to find the culprit, so I was wondering if you have experienced that with this newcamerahandler script?
 

SciNEStist

Well-known member
are you warping to the odd screens, or are you scrolling over to them?
One thing to test would be to put back the regualr camera handler to see if its still happening.
 

baardbi

Well-known member
Let me start by saying that I absolutely love the newcamerahandler. It's now part of my default NESmaker setup. But I have a question for you. I am having a problem with screen triggers. They only work on even screens. On odd screens the screen is already triggered when it loads. So screens on the X column (on the map) where X is 3, 5 ,7 etc. do not work. I'm trying to find the culprit, so I was wondering if you have experienced that with this newcamerahandler script?
My issue was totally unrelated to the newcamerahandler script. It was a mistake on my part.
 
Does this new camerahandeler make it so that you can change the selected monstergroup in the middle of a scrolling level?
Originally the monstergroup only gets loaded on the first screen of a scrolling level.

It looks to me like i can change the monstergroup mid-level in my game!!?? and it works fine in the emulator when i am playing the level.
But i do not know WHY it is working..
 

SciNEStist

Well-known member
if you change monstergroup, be aware that complications can happen if using monster groups from different tilesets.
 
Ok, thank you! This is great news for me.
Nice way to get more variety in the levels, being able to use diffrent monsters.
I am still only using one tileset for monsters. But thanks for the headsup!
 

force73

Member
Hi @SciNEStist - thank you! This solved some issues, finally.

UPDATE: SciNEStist fixed the following for me yesterday. If someone is interested in the changes, I will add them below.

I've got a video about a behaviour, I don't know if it's normal now:
View: https://www.youtube.com/watch?v=2U0DVbDxZmY

Description:
If the player re-enter a room after loose a life and the warp-in location is near the edge of the screen, the camera is scrolling (recenter the screen/ recenter the player to its normal x-axis position on the screen) in the opposite direction when the player starts walking. It could feel unusual, depends on the game you are making.

Answer:
It is the expected behaviour. If the character is close to the edge of the screen when respawn, the camera will recenter itself while start walking with the character.



Stop the camera recenter while start walking with the character:

The changes are based on the "newcamerahandler.asm" file from the first post (file version: Feb 16, 2023):

Change #1: Below "+doActivateScrollByte" (line 72 add the following 6 lines:
LDA Object_direction,x
AND #%00000100
CMP #%00000100
BNE +notfacingleft
RTS
+notfacingleft

Change #2: Below "+leftscrolling" (original line 90) change the complete part - all above the following "+doActivateScrollByte")
LEFT_SCROLL_PAD = #$60
LDX player1_object
LDA Object_direction,x
AND #%00000100
BNE +notfacingright
RTS
+notfacingright
LDA Object_x_hi,x
SEC
SBC camX
CMP #LEFT_SCROLL_PAD
BEQ +doActivateScrollByte
BCC +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS

Thanks :)
 
Last edited:

SciNEStist

Well-known member
yes, this is expected behaviour. your character is close to the left side, so the camera moves left to get you into the center area of the screen. (it doesnt care which direction you are moving, it just reads your speed and adjusts its position to keep you in that zone) you can prevent this by setting a left camera edge if you like, but that means you wont be able to move left on purpose either.
 

force73

Member
yes, this is expected behaviour. your character is close to the left side, so the camera moves left to get you into the center area of the screen. (it doesnt care which direction you are moving, it just reads your speed and adjusts its position to keep you in that zone) you can prevent this by setting a left camera edge if you like, but that means you wont be able to move left on purpose either.
Thank you for try it out and "fix" it. I've updated the post above this with a description for everyone interested in the changes you've made. :)
 

TalkingCat

Member
Hi @SciNEStist - thank you! This solved some issues, finally.

UPDATE: SciNEStist fixed the following for me yesterday. If someone is interested in the changes, I will add them below.

I've got a video about a behaviour, I don't know if it's normal now:
View: https://www.youtube.com/watch?v=2U0DVbDxZmY

Description:
If the player re-enter a room after loose a life and the warp-in location is near the edge of the screen, the camera is scrolling (recenter the screen/ recenter the player to its normal x-axis position on the screen) in the opposite direction when the player starts walking. It could feel unusual, depends on the game you are making.

Answer:
It is the expected behaviour. If the character is close to the edge of the screen when respawn, the camera will recenter itself while start walking with the character.



Stop the camera recenter while start walking with the character:

The changes are based on the "newcamerahandler.asm" file from the first post (file version: Feb 16, 2023):

Change #1: Below "+doActivateScrollByte" (line 72 add the following 6 lines:


Change #2: Below "+leftscrolling" (original line 90) change the complete part - all above the following "+doActivateScrollByte")


Thanks :)
Be careful using this code change. When setting the "left edge to scroll" and "right edge to scroll" screen flags, graphic artifacts occur when the player crosses the center line of the screen.Снимок экрана 2023-06-25 223947.png
Video_230625223451.gif
 

SciNEStist

Well-known member
is this problem happening with just the modifications mentioned above, or is it happening all the time with the newcamerahandler?
 
I added a little part to your excellent script.

I am using the scrollstop during bossfights from the L2R tutorial
flag 3 "right edge for scroll" - stops scrolling but restarts when all monsters defeated
flag 4 "right edge for scroll no Monster" stops scrolling even if all monsters are defeated

in the "newcameraholder.asm" about row 224 i added this part:

BCS +skipCheckForScrollScreenEdge

;;;;;;Added code for right edge for scroll/right edge for scroll no monster
LDA ScreenFlags00
AND #%00001000 ;;;right edge for scroll no monsters screenflag
BEQ +skipCheckForScrollScreenEdge
JMP noHorizontalCameraUpdate
+skipCheckForScrollScreenEdge
;;;;;

LDA ScreenFlags00
AND #%00010000 ;;;right edge for scroll screenflag
BEQ +skipCheckForScrollScreenEdge
JMP noHorizontalCameraUpdate
+skipCheckForScrollScreenEdge
 
need some help with screen movement @SciNEStist
I'm trying to emulate something like this in your scrolling engine:
ScreenTransition.gif
I'm close:
View: https://youtu.be/s6xBVnsuhdg

but it only seems to work on one screen not more than that
I started trying to use a variable that checks on the edge of the screen... that didn't work,
I also tried using the ScreenFlags... that didn't work either
it only seems to read this part of the script:
LDA ScreenFlags01
AND #%00010000
BNE +
JMP +leftautoscroll
+

and because of that it never reads this after that script:
LDA ScreenFlags01
AND #%00010000
BNE +
JMP +rightautoscroll
+
RTS
even when on edge and change
LDA ScreenFlags01
AND #%00010000
to:
LDA currentBattlefield
BNE +
for this check script on edge...
GetObjectDirection player1_object
CMP #FACE_RIGHT
BNE +goingLeft
ChangeFacingDirection player1_object, #FACE_DOWN
LDA #$01
STA currentBattlefield
JMP +doneHere
+goingLeft
ChangeFacingDirection player1_object, #FACE_DOWN
LDA #$02
STA currentBattlefield
+doneHere
It does the same thing in the video
so yeah... any advice?
anyway the script you made that I edited is attacked to this post if you want to see it... anyway thanks for reading!
 

Attachments

  • doUpdateCamera_L2R_PlatformBaseBB.zip
    3.2 KB · Views: 2

SciNEStist

Well-known member
ive always found the edge reaction scripts a little tricky to work with, so I've in the past done my own checks on player positions.

In theory, you would need to leave the left and right edge flags on and the auto scroll flag off in the screen settings, and the then when its time to force the screen to move, you would toggle one of the edge flags off and then the autoscroll flag on. this would start the scrolling. and since the flag changes arent saved, it would stop scrolling automatically when the next screen over is centered.

The first step I think would be to test this with an input script. something like for right D-pad: toggle right edge flag off and autoscroll flag on" and for left D-pad "toggle left edge flag off and auto scroll flag on"

if that works, then the next step would be to move the code out of the input scripts into something else.

I'll look into this tomorrow if you don't have it solved already by then
 
Top Bottom