Side Scroller to behind back segments.

codreapers86

New member
I was wondering if its possible anyones figured out how to go from side scroller to behind the back, Sort of like in Friday the 13th the game for nes where you go into the cabin and its sorta a puzzle style then when your fighting Jason its Punch out style. Hard to describe but if you played the NES game you know what I mean. lol
 

PasseGaming

Active member
It can definitely be done but I doubt that it is easily implemented using NESmaker. You'd probably have to do some straight coding to pull that off.
 

puppydrum64

Active member
I'm sure there's a few ways to achieve this. The way I did it for my game is as follows. (I didn't make a third-person view like you described but the same logic should work)

Note: Always save a copy of the file you're editing and edit that instead, leave the originals alone!

Go to the file "BASE_4_5\Game\Subroutines\doLoadScreenData.asm". This script is called whenever you warp to a new screen.

You should see this section of code in there (for me it ends around line 157 but it may vary)
Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState

What this does is set the new game state. It will automatically get the game state of the screen you're warping to and save it as the current game state. The variable gameState is set up like this:

screenwarp.png


So after "STA gameState" you can add a simple check to see if the game changed to the desired game state.

Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState
LDA gameState
CMP #$03 ;just for example let's say your "cabin" game state is defined as Game State 3
BNE +isNotCabin

;here we set player 1's game object to the game character that is controlled in the "cabin" sections, we'll assume for example it's game object #$0f
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$0f
STA Object_type,x ;this sets player 1's object type to #$0f
JMP +done

+isNotCabin
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$00 ;the first object in the list of game objects, we're assuming this is the original player 1 object but if not you can use that object's index here instead
STA Object_type,x ;this sets player 1's object type to #$00
+done

Now obviously you want your character to control differently during the "cabin" sections so you'll need to have different input scripts exclusive to that mode. If you use the above method, have the object that your player becomes when in that gamestate the "target" object for that input script.

EDIT: Fixed a bug with the code where it did not flow correctly.
 

codreapers86

New member
I'm sure there's a few ways to achieve this. The way I did it for my game is as follows. (I didn't make a third-person view like you described but the same logic should work)

Note: Always save a copy of the file you're editing and edit that instead, leave the originals alone!

Go to the file "BASE_4_5\Game\Subroutines\doLoadScreenData.asm". This script is called whenever you warp to a new screen.

You should see this section of code in there (for me it ends around line 157 but it may vary)
Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState

What this does is set the new game state. It will automatically get the game state of the screen you're warping to and save it as the current game state. The variable gameState is set up like this:

View attachment 4714


So after "STA gameState" you can add a simple check to see if the game changed to the desired game state.

Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState
LDA gameState
CMP #$03 ;just for example let's say your "cabin" game state is defined as Game State 3
BNE +isNotCabin

;here we set player 1's game object to the game character that is controlled in the "cabin" sections, we'll assume for example it's game object #$0f
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$0f
STA Object_type,x ;this sets player 1's object type to #$0f
JMP +done

+isNotCabin
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$00 ;the first object in the list of game objects, we're assuming this is the original player 1 object but if not you can use that object's index here instead
STA Object_type,x ;this sets player 1's object type to #$00
+done

Now obviously you want your character to control differently during the "cabin" sections so you'll need to have different input scripts exclusive to that mode. If you use the above method, have the object that your player becomes when in that gamestate the "target" object for that input script.

EDIT: Fixed a bug with the code where it did not flow correctly.


Oh wow thanks for the info. Ill check it out!!
 

offparkway

Active member
I'm sure there's a few ways to achieve this. The way I did it for my game is as follows. (I didn't make a third-person view like you described but the same logic should work)

Note: Always save a copy of the file you're editing and edit that instead, leave the originals alone!

Go to the file "BASE_4_5\Game\Subroutines\doLoadScreenData.asm". This script is called whenever you warp to a new screen.

You should see this section of code in there (for me it ends around line 157 but it may vary)
Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState

What this does is set the new game state. It will automatically get the game state of the screen you're warping to and save it as the current game state. The variable gameState is set up like this:

View attachment 4714


So after "STA gameState" you can add a simple check to see if the game changed to the desired game state.

Code:
    LDA screenLoadTemps
    AND #%01110000
    LSR
    LSR
    LSR
    LSR
    AND #%00000111
    STA gameState
LDA gameState
CMP #$03 ;just for example let's say your "cabin" game state is defined as Game State 3
BNE +isNotCabin

;here we set player 1's game object to the game character that is controlled in the "cabin" sections, we'll assume for example it's game object #$0f
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$0f
STA Object_type,x ;this sets player 1's object type to #$0f
JMP +done

+isNotCabin
LDX player1_object ;the initialization script sets this variable equal to zero when the game first starts and it stays that way
LDA #$00 ;the first object in the list of game objects, we're assuming this is the original player 1 object but if not you can use that object's index here instead
STA Object_type,x ;this sets player 1's object type to #$00
+done

Now obviously you want your character to control differently during the "cabin" sections so you'll need to have different input scripts exclusive to that mode. If you use the above method, have the object that your player becomes when in that gamestate the "target" object for that input script.

EDIT: Fixed a bug with the code where it did not flow correctly.
Excellent! I was using a longer code method of swapping player objects. This seems much more efficient.

however, I’m making a scrolling game and this method still gives me a glitchy column of tiles on the first scroll seam as I walk (at 1.5 screens into the level). Forever looking for a solution to that, so I’m all ears if you have any ideas!
 
Top Bottom