Made "CutScenes Introduction Screens" (for between Start Screen and Playable Screens)

dale_coop

Moderator
Staff member
NEW SCRIPTS !!!
CUTSCENES FOR NESMAKER 4.0.6 --> http://nesmakers.com/viewtopic.php?p=4010#p4010



OLD TECNHIQUE (4.0.0) :
Last night, I managed to make some "Introduction Screens" (in a not very beautiful way), to be played between the Start Screen and the first playable screen.

IntroScreens.gif


The technique I used is a variable "IntroScreens" initialized at "3" (because I have 3 intro screens) and used 3 normal screens that I designed like I wanted for my intro screens (assets, with some texts,... for exemple).
To link one screen to other, I used the "warp" functionality (as I can specify where my player will appear and I wanted to have him on the screen).

I made a script "WarpToNextScreen.asm" that check the "IntroScreens" variable, if not equal to "0", it decrease it and trigger a Warp! Else (if equal to "0", means no more Introduction screens to show, so the script to nothing). I assigned that script to the Press A button.

I modified all the the input/movement/loadScreens scripts to disable/skip some parts when the "IntroScreens" variable is not equal to "0".


(I will need to check with the v 4.0.2 that coming :p)
 

dale_coop

Moderator
Staff member
Design:

First of all, in the overworld, I make my 1st intro screen with my player, some text (I made assets, for now, but could definitly use textbox when I will figure out how use it). This screen will be shown when the game Start (when PressStart / or skip start screen).
It is my FIRST intro screen.
In the "Screen info", I defined what screen to "Warp to", that will be my 2nd intro screen.

Then, I design my 2nd intro screen with some text, ...
In the "Screen info", I defined what screen to "Warp to", that will be my 3nd intro screen.

Then, I design my 3nd intro screen with some text, ...
It's my last intro screen, beause I want only 3 intro screens (but if you want more you can continue...)
But even, in the "Screen info", I defined what screen to "Warp to" the screen that will be my playable game.

My playable screen is full of tiles, monsters, pickups… (and I will put a "checkpoint" type tile, at the exact place where my player will warp in: when he loose a life, he will start from here).

Oh, and, if you have gravity (plateformer) like me, don't forget to put a solid tile under your player in each screen (else, he will fall when warped in) :p


Scripts:

In the "SystemVariable.asm" script, I declare a "IntroScreens" variable:
Code:
  IntroScreens .dsb 1  ;;for intro cut screens

In the "InitLoads.asm" script, I initialize the variable (number of intro screens I want):
Code:
	LDA #$03
	STA IntroScreens

In the "HandleScreenLoads.asm" script, at line 320 (just before the "LDA HudHandler" line), I add some code to skip/hide the HUD when IntroScreens:
Code:
    LDA IntroScreens
    BNE skipDrawingHud_GameHandler


I make a "IntroScreens_WarpToNextScreen.asm" script (in the "\InputScripts" folder):
Code:
warpToNextScreen:
  LDA IntroScreens                     ;; check the n° of IntroScreens
  BNE continueWarpingToNextScreen      ;; if not equal to "0" means still intro screens to show 
  JMP doNothingForWarpingToNextScreen  ;; elsewe do nothing
  
continueWarpingToNextScreen:
  DEC IntroScreens  ;; decrease the n° of IntroScreens

  ;; warp to the next screen:
  LDA warpMap       ;; warp to next screen
  ADC #$07
  STA temp
  GoToScreen warpToScreen, temp
  
doNothingForWarpingToNextScreen:
  RTS

Now, in "Input Editor", I assign this script to the "PRESS" "A" button (or button you want to go one screen to the next one)

And, I modify the "changeToWalkingAnimation.asm" script to skip when IntroScreens:
Code:
    LDA IntroScreens  ;; check the n° of IntroScreens, if not "0" then we skip all the animations code
    BNE finishedChangingToWalkAnimation

    LDX player1_object
    ChangeObjectState #$01, #$10

finishedChangingToWalkAnimation:
    RTS

And same for all the "startMovingPlayerXxx.asm" to skip when IntroScreens.
Here, for exemple the "startMovingPlayerRight.asm":
Code:
    LDA IntroScreens  ;; check the n° of IntroScreens, if not "0" then we skip all the movement code
    BNE finishedMovingPlayerRight

    StartMoving player1_object, MOVE_RIGHT
    LDX player1_object
    LDA Object_movement,x
    AND #%11111000
    ORA #%00000010
    STA Object_movement,x
	
finishedMovingPlayerRight:
    RTS


Voilà. I hope to have forgotten nothing

(I will need to check with the v 4.0.2 that coming :p)
 

dale_coop

Moderator
Staff member
The only problem is, once these scripts are modified, it means you will need to set up 3 introduction screens for each game you make !

Need to find a way to have user variables that are defined/initialized by the project (like the ones used in the HUD) and not in the common scripts.
 

WolfMerrik

New member
This is an awesome way to do this, and it seems like it works pretty darn well. With some clever coding and graphics work, you could probably add some pretty cool stuff to make them like a full blown cutscene, great work!

dale_coop said:
...a way to have user variables that are defined/initialized by the project (like the ones used in the HUD) and not in the common scripts.

This would be a GREAT feature suggestion.

With this, In regards to the reply about adding 6 point collision detection, middle points for the player could be added here as well, rather than hardcoding them into the scripts, they could be read from here.
 

dale_coop

Moderator
Staff member
WolfMerrik said:
This would be a GREAT feature suggestion.

With this, In regards to the reply about adding 6 point collision detection, middle points for the player could be added here as well, rather than hardcoding them into the scripts, they could be read from here.

Exactly!
We will see in the 4.0.6... what Joe added.
 

WolfMerrik

New member
It will definitely open up a LOT of possibilities!

Also, Thanks for sharing this post, this was something (albeit way down the road for me) I was wondering how to do.
 

dale_coop

Moderator
Staff member
Ok I watched the tutorial video for the new version of NESMaker, started playing with it too...
I have some ideas to improve my scripts. I will test that today and update my tutorial ;)
 

WolfMerrik

New member
dale_coop said:
Ok I watched the tutorial video for the new version of NESMaker, started playing with it too...
I have some ideas to improve my scripts. I will test that today and update my tutorial ;)

I look forward to it! You have been making and sharing some awesome stuff!
 

dale_coop

Moderator
Staff member
With the release of NESaker 4.0.6, I decided to modify my script to make it more versatile.
So here my new version.

It's is meant to be use with the AdventureModule.MOD in NESMaker 4.0.6


IntroScreens.gif



Technique:

For that, I use normal screens for the cutscenes / introduction screens, design them as I want (assets, with some texts,... for exemple). And FLAG them as "cutscene" (I hijack the currently not used "Screen Flag 4" that I will rename as "Cutscene screen").
To link one screen to other, I used the "warp" functionality.

I made a script "Cutscenes_WarpToNextScreen.asm" that check if the current screen is a "Cutscene screen", if so, it triggers a Warp! Else the script does nothing. I assigned that script to the Press A button.

I modified all the the input/movement/loadScreens scripts to disable/skip some parts when on a "Cutscene screen".


Design:

In the "Project Settings > Project Labels" , I rename the "Screen Flag 4" to "Cutscene screen".

01_Project_Settings.png


First of all, in the overworld, I make my 1st Cutscene screen with my player, some text (I made assets, for now, but could definitly use textbox when I will figure out how use it). This screen will be shown when the game Start (when PressStart / or skip start screen).
It is my FIRST Cutscene screen.
In the "Screen info", I set the screen as "Cutscene screen" and defined what screen to "Warp to", that will be my 2nd Cutscene screen.

02_Screen_Infos.png


Then, I design my 2nd Cutscene screen with some text, ...
In the "Screen info", I set the screen as "Cutscene screen" and defined what screen to "Warp to", that will be my 3nd Cutscene screen.

Then, I design my 3nd Cutscene screen with some text, ...
It's my last Cutscene screen, beause I want only 3 Cutscene screens (but if you want more you can continue...)
But even, in the "Screen info", again, I set the screen as "Cutscene screen" and defined what screen to "Warp to" the screen that will be my playable game.

My playable screen is full of tiles, monsters, pickups… (and I will put a "checkpoint" type tile, at the exact place where my player will warp in: when he loose a life, he will start from here).

Oh, and, if you have gravity (plateformer) like me, don't forget to put a solid tile under your player in each screen (else, he will fall when warped in) :p


Scripts:

In the "HandleScreenLoads.asm" script, at line 320 (just before the "LDA HudHandler" line), I add some code to skip/hide the HUD when on a Cutscene screen:

Code:
    ;; dale_coop: check for the cutscenes screens 
    LDA ScreenByte01
	AND #%00010000  ;; check if a cutscene screen flag
    BNE skipDrawingHudForCutScene
	JMP continueDrawingHudForCutScene
skipDrawingHudForCutScene:
    ;; Uncomment, if you want Hide the player during cutscene (cf. CutScenes_WarpToNextScreen.asm too) 
    ;;ChangeObjectState #$05, #$02  ;; change to action step 5 
    ;; skip the HUD drawing (= no HUD)
    JMP skipDrawingHud_GameHandler
continueDrawingHudForCutScene:
    ;; dale_coop: continue as usual


I make a "Cutscenes_WarpToNextScreen.asm" script (in the "\Routines\UserScripts\AdventureGame_Base\InputScripts\InputScripts" folder):

Code:
warpToNextScreen:
  ;; dale_coop: check for the cutscenes screens 
  LDA ScreenByte01
  AND #%00010000  ;; check if a cutscene screen flag
  BNE continueWarpingToNextScreen      ;; if cutscene we warp 
  JMP doNothingForWarpingToNextScreen  ;; else we do nothing
  
continueWarpingToNextScreen:
  ;; warp to the next screen:
  LDA warpMap
  clc
  adc #$01

  STA temp
  GoToScreen warpToScreen, temp

doNothingForWarpingToNextScreen:
  ;; Uncomment, if you want Hide the player during cutscene (cf. handleScreenLoads.asm too)
  ;; check the current state
  ;;GetCurrentActionType player1_object
  ;;CMP #$05                      ;; if action step 5 (cutscene)
  ;;ChangeObjectState #$00, #$02  ;; change to action step 0 (idle)
  RTS

Now, in "Input Editor", I assign THAT script to the "PRESS" "A" button (or button you want to go one screen to the next one)


And, I modify all the "startMovingPlayerXxx.asm" to skip when on a Cutscene screen.
Here, for exemple the "startMovingPlayerRight.asm":

Code:
    ;; dale_coop: check for the cutscenes screens 
    LDA ScreenByte01
	AND #%00010000  ;; check if a cutscene screen flag
    BNE finishedMovingPlayerRight

    LDX player1_object
    GetCurrentActionType player1_object
    CMP #$02 ;; attack
    BEQ ++
    CMP #$01
    BEQ +
     ChangeObjectState #$01, #$04
 +
    StartMoving player1_object, MOVE_RIGHT
 ++
     FaceDirection player1_object, FACE_RIGHT
    RTS

finishedMovingPlayerRight:
   RTS


Also something similar in the "a_create_projectile.asm" script:

Code:
    ;; dale_coop: check for the cutscenes screens 
    LDA ScreenByte01
	AND #%00010000  ;; check if a cutscene screen flag
    BNE skipCreatingProjectile
	JMP canContinueCreatingProjectile
skipCreatingProjectile:
    JMP doneShooting
canContinueCreatingProjectile:

 LDA gameHandler
    AND #%00100000
    BEQ notNPCstate_proj
 JMP doneShooting
 notNPCstate_proj
 LDA weaponsUnlocked
 AND #%00000010
 BNE canShoot
 JMP doneShooting
canShoot:
LDX player1_object
 GetCurrentActionType player1_object


 CMP #$02
 BNE notAlreadyShooting
 JMP doneShooting 
notAlreadyShooting
 ;;; don't attack if already attacking.
 ;;; do we have to check for hurt here?
 ;;;;; Here, we WOULD create melee
 ChangeObjectState #$02, #$02
 LDA Object_movement,x
 AND #%00001111
 STA Object_movement,x
 LDA #$00
 STA Object_h_speed_hi,x
 STA Object_h_speed_lo,x
 STA Object_v_speed_hi,x
 STA Object_v_speed_lo,x
 
 LDA Object_x_hi,x
 ;;; offset x for creation
 CLC
 ADC #$04
 STA temp
 LDA Object_y_hi,x
 CLC
 ADC #$04
 STA temp1
 
 LDA Object_movement,x
 AND #%00000111
 STA temp2

 
    CreateObject temp, temp1, #$03, #$00
  
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    LDY temp2
    LDA directionTable,y
    ORA Object_movement,x
    STA Object_movement,x
      PlaySound #sfx_shoot
doneShooting:

RTS


;;000 down
;010 right
;100 up
;110 left


And in the "b_create_melee.asm" script:

Code:
    ;; dale_coop: check for the cutscenes screens 
    LDA ScreenByte01
	AND #%00010000  ;; check if a cutscene screen flag
    BNE skipCreatingMelee
	JMP canContinueCreatingMelee
skipCreatingMelee:
    JMP doneAttacking
canContinueCreatingMelee:

 LDA gameHandler
 AND #%00100000
 BEQ notNPCstate_attack
 JMP doneAttacking
notNPCstate_attack
 LDA weaponsUnlocked
 AND #%00000001
 BNE canAttack
 JMP doneAttacking
canAttack:
LDX player1_object
 GetCurrentActionType player1_object

 CMP #$02
 BNE notAlreadyAttacking 
 JMP doneAttacking
notAlreadyAttacking
 ;;; don't attack if already attacking.
 ;;; do we have to check for hurt here?
 ;;;;; Here, we WOULD create melee
 ChangeObjectState #$02, #$02
 LDA Object_movement,x
 AND #%00001111
 STA Object_movement,x
 LDA #$00
 STA Object_h_speed_hi,x
 STA Object_h_speed_lo,x
 STA Object_v_speed_hi,x
 STA Object_v_speed_lo,x
 
 LDA Object_x_hi,x
 STA temp
 LDA Object_y_hi,x
 STA temp1
 
 LDA Object_movement,x
 AND #%00000111
 STA temp2
 AND #%00000010 ;; this will be 0 on up and down, but 1 on left right
 BNE createLRmelee
    LDA temp2
    TAY
    LDA temp
    SEC
    SBC #$08 ;; width of weapon
    CLC
    ADC weaponOffsetTableX,y
    STA temp
    LDA temp1
    SEC
    SBC #$10
    CLC
    ADC weaponOffsetTableY,y
    STA temp1
 
  CreateObject temp, temp1, #$01, #$00
  JMP meleeCreated
createLRmelee:
    LDA temp2
    TAY
    LDA temp
    SEC
    SBC #$10 ;; width of weapon
    CLC
    ADC projOffsetTableX,y
    STA temp
    LDA temp1
    SEC
    SBC #$08
    CLC
    ADC projOffsetTableY,y
    STA temp1
 CreateObject temp, temp1, #$02, #$00
meleeCreated:
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
    PlaySound #sfx_slash
doneAttacking:

RTS


;;000 down
;010 right
;100 up
;110 left


Voilà. I hope to have forgotten nothing
 

WolfMerrik

New member
Dude, this is totally awesome!
I going to be adding the ability to add links to outside resources (for things like tutorials and videos and the like) If I may, I would definitely like to add this when I do!
This is a very well written tutorial!

Again, thanks so much for sharing this!
 

SeaFoodAndButter

New member
Hey, do you think it's possible to use a fullscreen (128x128) tileset as a cut scene?

For example: Let' say I had no need for the shop screen tileset. Couldn't there be a way to make the game go directly to that screen after you, say, press Start on the start screen? So instead of pressing start and going to the overworld screen right away, you would go to the shop tileset (which is a fullscreen tileset just like the start screen). On this screen you could have graphics, some text, and music like how the start screen does. Then press start again and THEN go to the overworld to start the game.

I saw a few fullscreen tilesets that I won't be needing. The type of cuts scenes I want is where a graphic shows on the screen with text and music, you press start, go to another like similar screen, etc. After you finally press start on the last screen, the game starts. Something similar to the opening of Journey to Silious.
 

dale_coop

Moderator
Staff member
I know Joe will propose soon a cutscene system based on Special Screens (like Start and Win screens).
Currently, I made just a small cutscenes / introduction screens system, easy to implement, easy to use with the 4.0.6... just for fun! (learning purpos)
But don't worry, real fullscreen Cutscenes will come in a few days... ;)
 

Bucket Mouse

Active member
dale_coop said:
Then, I design my 2nd Cutscene screen with some text, ...
In the "Screen info", I set the screen as "Cutscene screen" and defined what screen to "Warp to", that will be my 3nd Cutscene screen.

Then, I design my 3nd Cutscene screen with some text, ...
It's my last Cutscene screen, beause I want only 3 Cutscene screens (but if you want more you can continue...)

I have a question....when you say "text" do you mean text boxes? If not, do you think there's a way to implement them automatically here?

Because the only other way would be to use background tile data, which only lets you work in 16x16 blocks, and you can see the problem...
 

dale_coop

Moderator
Staff member
On my exemple, I put some text in tiles (yeah I know... but I did that in the 4.0.0 version).
So yes, after watch the tutorial video for 4.0.6, I think you could set up some screen text box... (maybe triggered by a NPCtype tile at the exact place your player is warped in?)
Need to dig int text boxes... because just watched the video last night, and spend my day at work (job).
 
Top Bottom