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

SciNEStist

Well-known member
I haven't tested this, but the way I would go about it is to change any mention of "player1_object" in the camerahandler with either "player2_object" or even better, replace it with "camObject" and then make sure you assign player2 as the camObject like this:
Code:
LDA player2_object
STA camObject
 

smilehero65

Active member
I haven't tested this, but the way I would go about it is to change any mention of "player1_object" in the camerahandler with either "player2_object" or even better, replace it with "camObject" and then make sure you assign player2 as the camObject like this:
Code:
LDA player2_object
STA camObject
Well that was my first guess :unsure:
However, player 1 was still in the lead of scroll.

The code you put seems like a good idea, too, but got the same results.
However I suspect the issue is in how NESMaker handles player 2.
 

dale_coop

Moderator
Staff member
Well that was my first guess :unsure:
However, player 1 was still in the lead of scroll.

The code you put seems like a good idea, too, but got the same results.
However I suspect the issue is in how NESMaker handles player 2.
Or the way that modified scripts handle the scrolling...?
 

smilehero65

Active 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

I think other thread that can be added to the OTHER FIXES are:

Enemies falling off ledges on the left side cause player to die in platformer
 

SciNEStist

Well-known member
scrolling in nesmaker is already a house of cards, throwing bank switches in might be a little more complicated than its worth tbh.
 
@SciNEStist somewhat unrelated but I'm helping with a platformer project and am trying to get scrolling working with a screen warp where it saves the player's and camera's position.
I've toyed with it a bit in doLoadScreenData.asm:
SetToPositionValue:
LDX player1_object
LDA Object_x_hi,x
STA newX
LDA Object_y_hi,x
STA newY
LDA ScreenFlags00
AND #%00100000 ;;ignore if screen edge left
BNE skipSettingWarpInXY
AND #%00010000 ;;ignore if screen edge right
BNE skipSettingWarpInXY
LDA Object_x_hi,x
STA camX ;;; align the camera
JMP skipSettingWarpInXY
but that only puts the camera lined up at the edge of the screen... the player warps fine though.
I've looked through your camera script to see what I can do... but there's a lot to look over.
any idea on how to handle this while warping?
 
Top Bottom