[4.5.6] Side Scrolling Platformer

slobu

New member
My ByteOff 2020 entry game design needs side scrolling.

I'm not sure if this is already part of 4.5.6. or, if an old module will work.

If this is in the works I might do everything I can besides actual "coding" and really dig in when the module / tutorial is out.


Forgive me if I'm missing something important in requesting this. Thank you for your consideration!
 

AllDarnDavey

Active member
I'm pretty sure a 2way platform scrolling tutorial is on the way.

If you cannot wait, the 4.5.6 summer camp tutorials cover this around part 8, I believe. I actually just got left right platform working myself the other night, I followed the beginner arcade_platform tutorial (but started the project using the scrolling platform module), then after getting basic non scrolling platform working, I found the part in the summer camp tutorials series that goes over adding scrolling, and went from there.

I think the only major hiccup I encountered, was that doUpdateCamera_L2R_PlatformBase.asm despite the name, had the code for left scrolling commented out, so even though I had set it up correctly, it would only scroll right. Once I figured that out, I was good to go.
 

slobu

New member
AllDarnDavey said:
I'm pretty sure a 2way platform scrolling tutorial is on the way.

If you cannot wait, the 4.5.6 summer camp tutorials cover this around part 8, I believe. I actually just got left right platform working myself the other night, I followed the beginner arcade_platform tutorial (but started the project using the scrolling platform module), then after getting basic non scrolling platform working, I found the part in the summer camp tutorials series that goes over adding scrolling, and went from there.

I think the only major hiccup I encountered, was that doUpdateCamera_L2R_PlatformBase.asm despite the name, had the code for left scrolling commented out, so even though I had set it up correctly, it would only scroll right. Once I figured that out, I was good to go.


Thank you! Sounds like a winning strategy.

Also, good to hear an official tutorial is in the works. It's been a joy to pour over the 4.5.6 videos in the new format.
 

AllDarnDavey

Active member
Because you only need to make a handful of changes to the arcade platform tutorial. I figured I'd write up a quick how-to for anyone interested.

First start a new NESmaker 4.5.6 project. Create Blank Tileset, and select LR_Platformer_BASE_456.mod from the list.
NewProjectLRplatform.PNG

Download the Assets for the Arcade Style Platform Tutorial:

Follow the Arcade Style Platform Beginner Tutorial.
Import the tilesets, monsters, gameobjects, monsters, palettes, monster palettes, and sound.
Once you have a working single screen platform set up, make sure you have a few screens connected horizontally to scroll through.
scrollingScreens.PNG

Now we just need to add the scroll left & scroll right input scripts, you'll find them in the folder: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\MOD_PlatformerBase\Inputs\
scrollScripts.PNG

Add those scripts to the input editor, as hold left and hold right inputs (don't replace the normal move left, and move right, you still need those too).
ScrollInputScripts.PNG

Now we just need to enable scrolling...
Make a copy of the Initialization.asm script here: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\
and give it a unique name like Initialization_LRscroll.asm
Assign this new unique Initialization script under project settings>script settings>Game>Initialize
Open it and around line 87 change this text:
Code:
	;LDA #%00110000
	LDA #$00
	STA scrollTrigger
	;;;;; this sets up to ignore "screen edge" behavior
	;;;;; for scrolling games.
	;;Bit 7 = up
	;;Bit 6 = Down
	;;Bit 5 = left
	;;Bit 4 = right
To this:
Code:
	LDA #%00110000
	;LDA #$00
	STA scrollTrigger
	;;;;; this sets up to ignore "screen edge" behavior
	;;;;; for scrolling games.
	;;Bit 7 = up
	;;Bit 6 = Down
	;;Bit 5 = left
	;;Bit 4 = right
We're uncommenting out the line that sets LRscrolling, and commenting out the line that disables it.

That's it, if you play the game you should have scrolling... except, unless you got a fixed version of the module changed after I'm writing this, you'll only have right scrolling and not left scrolling, which is fine if you want it to work like Super Mario Bros. However, if you want both left & right scrolling, we just need to uncomment out the lines disabling it.

Open the file doUpdateCamera_L2R_PlatformBase.asm.
You'll find it here: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\MOD_PlatformerBase\Subroutines\

At lines 31 - 51 you'll find the left scrolling code disabled:
Code:
		; ;; is left camera update
		; LDA camX_lo
		; sec
		; sbc tempA
		; STA camX_lo
		; LDA camX
		; sbc tempB
		; STA temp
			; BCS +skipCheckForScrollScreenEdge
				; LDA ScreenFlags00
				; AND #%00100000
				; BEQ +skipCheckForScrollScreenEdge
					; JMP noHorizontalCameraUpdate
		; +skipCheckForScrollScreenEdge
		; LDA temp
		; STA camX
		
		; LDA camX_hi
		; sbc #$00
		; STA camX_hi
		; JSR getCamSeam
		JMP noHorizontalCameraUpdate

Just delete the semi-colon to re-enable left scrolling, like this...
Code:
		; ;; is left camera update
		LDA camX_lo
		sec
		sbc tempA
		STA camX_lo
		LDA camX
		sbc tempB
		STA temp
			BCS +skipCheckForScrollScreenEdge
				LDA ScreenFlags00
				AND #%00100000
				BEQ +skipCheckForScrollScreenEdge
					JMP noHorizontalCameraUpdate
		+skipCheckForScrollScreenEdge
		LDA temp
		STA camX
		
		LDA camX_hi
		sbc #$00
		STA camX_hi
		JSR getCamSeam
		JMP noHorizontalCameraUpdate

BOOM! Left and Right scrolling should now work.
The only other thing is to tell NESmaker where to stop scrolling. You do this by setting Screen Flags in Screen Info. Set Left Edge for Scroll flag on the left most screen, and set the Right Edge for Scroll flag on the right most screen. Leave these flags unchecked for all the screens in between.
LRscrolling.gif
 

BeefQuestBeef

New member
This works great.... except the part where my left and right screen flags are being ignored. Just keeps on a-scrollin. Any idea why this is happening? (NOTE: I am now using 4.5.9)
 

AllDarnDavey

Active member
This works great.... except the part where my left and right screen flags are being ignored. Just keeps on a-scrollin. Any idea why this is happening? (NOTE: I am now using 4.5.9)
This was made before the final 4.5.6 MetroidVania & Scrolling Platform modules and tutorials existed. Early unfinished modules existed back then, but lacked tutorials and weren't finalized yet, I just got the basics working a bit early. I'm pretty sure both modules also got a few small updates and bug fixes when the official tutorials did come out.

I would recommend following the the Actual Module Tutorials for MetroidVania there's a good chance this older stuff might have issues with the final updates. Your game doesn't actually have to work like a Metroid style game that's just the module with 2 way scrolling, instead of 1 way ratchet scrolling like the scrolling platform module / tutorial.
 

capacitor

New member
Because you only need to make a handful of changes to the arcade platform tutorial. I figured I'd write up a quick how-to for anyone interested.

First start a new NESmaker 4.5.6 project. Create Blank Tileset, and select LR_Platformer_BASE_456.mod from the list.
View attachment 3320

Download the Assets for the Arcade Style Platform Tutorial:

Follow the Arcade Style Platform Beginner Tutorial.
Import the tilesets, monsters, gameobjects, monsters, palettes, monster palettes, and sound.
Once you have a working single screen platform set up, make sure you have a few screens connected horizontally to scroll through.
View attachment 3324

Now we just need to add the scroll left & scroll right input scripts, you'll find them in the folder: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\MOD_PlatformerBase\Inputs\
View attachment 3325

Add those scripts to the input editor, as hold left and hold right inputs (don't replace the normal move left, and move right, you still need those too).
View attachment 3326

Now we just need to enable scrolling...
Make a copy of the Initialization.asm script here: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\
and give it a unique name like Initialization_LRscroll.asm
Assign this new unique Initialization script under project settings>script settings>Game>Initialize
Open it and around line 87 change this text:
Code:
    ;LDA #%00110000
    LDA #$00
    STA scrollTrigger
    ;;;;; this sets up to ignore "screen edge" behavior
    ;;;;; for scrolling games.
    ;;Bit 7 = up
    ;;Bit 6 = Down
    ;;Bit 5 = left
    ;;Bit 4 = right
To this:
Code:
    LDA #%00110000
    ;LDA #$00
    STA scrollTrigger
    ;;;;; this sets up to ignore "screen edge" behavior
    ;;;;; for scrolling games.
    ;;Bit 7 = up
    ;;Bit 6 = Down
    ;;Bit 5 = left
    ;;Bit 4 = right
We're uncommenting out the line that sets LRscrolling, and commenting out the line that disables it.

That's it, if you play the game you should have scrolling... except, unless you got a fixed version of the module changed after I'm writing this, you'll only have right scrolling and not left scrolling, which is fine if you want it to work like Super Mario Bros. However, if you want both left & right scrolling, we just need to uncomment out the lines disabling it.

Open the file doUpdateCamera_L2R_PlatformBase.asm.
You'll find it here: \NESmaker_4_5_6\GameEngineData\Routines\BASE_4_5\Game\MOD_PlatformerBase\Subroutines\

At lines 31 - 51 you'll find the left scrolling code disabled:
Code:
        ; ;; is left camera update
        ; LDA camX_lo
        ; sec
        ; sbc tempA
        ; STA camX_lo
        ; LDA camX
        ; sbc tempB
        ; STA temp
            ; BCS +skipCheckForScrollScreenEdge
                ; LDA ScreenFlags00
                ; AND #%00100000
                ; BEQ +skipCheckForScrollScreenEdge
                    ; JMP noHorizontalCameraUpdate
        ; +skipCheckForScrollScreenEdge
        ; LDA temp
        ; STA camX
       
        ; LDA camX_hi
        ; sbc #$00
        ; STA camX_hi
        ; JSR getCamSeam
        JMP noHorizontalCameraUpdate

Just delete the semi-colon to re-enable left scrolling, like this...
Code:
        ; ;; is left camera update
        LDA camX_lo
        sec
        sbc tempA
        STA camX_lo
        LDA camX
        sbc tempB
        STA temp
            BCS +skipCheckForScrollScreenEdge
                LDA ScreenFlags00
                AND #%00100000
                BEQ +skipCheckForScrollScreenEdge
                    JMP noHorizontalCameraUpdate
        +skipCheckForScrollScreenEdge
        LDA temp
        STA camX
       
        LDA camX_hi
        sbc #$00
        STA camX_hi
        JSR getCamSeam
        JMP noHorizontalCameraUpdate

BOOM! Left and Right scrolling should now work.
The only other thing is to tell NESmaker where to stop scrolling. You do this by setting Screen Flags in Screen Info. Set Left Edge for Scroll flag on the left most screen, and set the Right Edge for Scroll flag on the right most screen. Leave these flags unchecked for all the screens in between.
View attachment 3327
All this is very cool and works very well, the only problem for for me is that the seccond screen flags(ScreenFlags01)are desactivated affter the changes
 
Top Bottom