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

SciNEStist

Well-known member
DOWNLOAD HERE

I've been working on my own game and thought that people might benefit from a few tweaks/changes I've made to the doUpdateCamera script. (the script that handles all scrolling)

Below is a version of the script that I've modified mostly by copy/pasting from other peoples tweaks. It started with the most stable scrolling script I am aware of, the "Scrolling with Re-centering" by AllDarnDavey, which corrects a lot of screen issues on its own


Bug Fixes:

-Multiple objects spawning at once when scrolling
-No inputs scripts needed
-Screen flags no longer update every frame, instead they update when a new screen is centered. so changes can be made without being lost immediatly
-Warpto screen now updates, no longer only uses the settings set on the first screen of the level

New Features:

-toggle between no scroll, autoscroll, and player following "camera modes"
-all scrolling features can be adjusted screen by screen, so you can have sections that autoscroll and sections that follow the player in the same level.
-left and right scrolling/autoscrolling
-adjust autoscroll speed with "screenSpeed" variable in screen settings dropdown
-while scrolling, the following gets adjusted when the new screen comes fully into frame:
  • scroll speed
  • screen flags
  • warpto screen
  • tile pallette
  • music
HOW TO USE THIS
A more detailed walkthrough can be found HERE (thank you baardbi )
1: replace your "handle camera" script with the file attached to this post
2: delete all the input scripts that control scrolling
  • By default, the camera will follow the player. To change to autoscroll, screenflag6 is the flag to check. (this can be changed at the beginning of the script)
  • To determine the direction of the autoscroll, check "right edge for scroll" to go left, and "left edge for scroll" to go right.
  • For no scrolling at all, check both the right and left edge flags and the camera will not move
  • When the scrolling comes across a scroll edge, it will stop. to start it going again, uncheck the screen flag. for example, this will uncheck right edge:
Code:
LDA ScreenFlags00
   AND #%11101111
   STA ScreenFlags00


I'm sure theres a lot that can be improved or made more efficient. IF anyone has any suggestions or issues, we can all edit it together and I'll keep it updated on this first post.

EXTRA:
you can edit your physics script to help push your player along any autoscrolling areas: https://www.nesmakers.com/index.php...-along-with-your-camera-scrolling-4-5-9.8055/
for horizontal shooter games, adjust the speed of your ship along with the scrolling here: http://www.nesmakers.com/index.php?...-dohandlecamera-updates-fixes.7929/post-48125
OTHER FIXES

FOR COLLISION FIX WITH THE SEAM, CHECK OUT THIS LINK: https://www.nesmakers.com/index.php?threads/scrolling-platformer-seam-collision-fix-4-5-9.7266/

FOR CORRUPTED TILES DURING SCROLLING AFTER WARPING: http://www.nesmakers.com/index.php?...arping-without-buffer-screens.7295/post-40092

FOR CLEANING OUT TILE GLITCHES AND FREEING SPACE: https://www.nesmakers.com/index.php...freeing-some-space-in-scrolling-modules.8657/
 

Attachments

  • newcamerahandler.zip
    3.7 KB · Views: 166
Last edited:

dale_coop

Moderator
Staff member
Why using a new userscreenbyte (userscreenbyte6) to handle the scrolling when we already have the screenFlags00 for that?
We could just dedicate a new bit of the screenflags for the "auto scroll" feature.
 

SciNEStist

Well-known member
Why using a new userscreenbyte (userscreenbyte6) to handle the scrolling when we already have the screenFlags00 for that?
We could just dedicate a new bit of the screenflags for the "auto scroll" feature.

I suppose I didnt want to take up multiple screenflags to select any additional camera modes that get added when i could use 1 userscreenbyte. (am thinking of adding more down the line, like a camera that tracks 2 objects, or left scrolling)
 

Peter Schmitz

Active member
will give it a try - but probably next week. I guess this is what you were talking about in the discord channel, right?
And if I understand correctly, I implement your new camerahandler and if I plan to enable right scrolling again, e.g. activated via a tile collision, I use the code above, right?

Will give you feedback afterwards, but thanks for sharing =)
 

dale_coop

Moderator
Staff member
I suppose I didnt want to take up multiple screenflags to select any additional camera modes that get added when i could use 1 userscreenbyte. (am thinking of adding more down the line, like a camera that tracks 2 objects, or left scrolling)
I mean, the "left edge for scroll" (for no left scroll) and "right edge for scroll" (for no right scroll) already exists, we would just need to add "auto scroll".
Using only that (already exisiting) variable "ScreenFlags00", we can deal with all the cases you specified in your original post (no need to add a new variable)
 

crazygrouptrio

Active member
I mean, the "left edge for scroll" (for no left scroll) and "right edge for scroll" (for no right scroll) already exists, we would just need to add "auto scroll".
Using only that (already exisiting) variable "ScreenFlags00", we can deal with all the cases you specified in your original post (no need to add a new variable)
That's how I did it.
 

SciNEStist

Well-known member
adding left scrolling and setting it up to work off flags as suggested. any preference for which flag is used for autoscroll?
 

SciNEStist

Well-known member
updated.
-added left scrolling
-changed system to work off flags only, no userscreenbytes
-added warptoscreen update (will need to test this, but it should allow us to change the warpto screen so it doesnt always go off the first screen)
 

SciNEStist

Well-known member
UPDATE AGAIN: that last version introduced a bug that stopped it from recognizing the screenflags during scroll, which is pretty much the most important thing.
THANK YOU @Peter Schmitz for letting me know! the fixed version is uploaded now

If anyone else uses this script, please let me know if you have any trouble, I'm willing to help. (or lemme know if you dont have trouble, it boosts my ego)
 

Peter Schmitz

Active member
UPDATE AGAIN: that last version introduced a bug that stopped it from recognizing the screenflags during scroll, which is pretty much the most important thing.
THANK YOU @Peter Schmitz for letting me know! the fixed version is uploaded now

If anyone else uses this script, please let me know if you have any trouble, I'm willing to help. (or lemme know if you dont have trouble, it boosts my ego)
Now it works like a charm - thanks. =) Tried to re-enable scrolling by colliding with a specific tile and this works flawlessly as well =)
 

tbizzle

Well-known member
I've ran into a couple of problems. When I get past the 2 start screens, and two Main Game screens the game starts to scroll on me? And when I finally reach my scrolling level ( I have 5 screens made) It only shows the first 2 of the 5 screens. @SciNEStist any ideas what could be causing these issues?

 

SciNEStist

Well-known member
do you have screen flag 6 clicked on the screen that scrolls? if you dont want it to autoscroll, uncheck that flag

if flag 6 is unchecked, thenn make sure you check the right and left scroll edge flags to prevent follow scrolling
 
Last edited:

tbizzle

Well-known member
@SciNEStist I'm going to check flag 6 for the scrolling screens, I didn't have it checked before. Then for the screens that do not scroll, I did have both right and left edge checked, do i need to check flag 6 for those also?
 
Top Bottom