[4.5.6] Simple Pause for Metroidvania Module

9Panzer

Active member
So the Pause script eluded me for quite some time. I'm in my 10th month of game development with nesmakers and have solved (with the help of the community) most of my challenges. This one I had basically given up on as I just couldn't get anything to work. Fortunately @SpiderDave gave me a code he used in a previous version that I managed to pull apart and make work perfectly in 4.5.6. I spruced it up a little using @Mugi code to soften the screen palette when it is triggered as well. I wasn't able to get an SFX to work with it though.

This should just be a quick copy and paste for usage in an input script (Most likely start) Hopefully someone else can find this useful!
Make sure to create a User Variable called "pause_game"
Also, The input should be set to RELEASE rather then push. For whatever reason it doesn't like push.


doPause:

INC pause_game

LDA pause_game
CMP #$02

BNE +IsNotPaused
LDA #$00
STA pause_game
LDA soft2001
AND #%00011111
STA soft2001
RTS

+IsNotPaused
LDA pause_game
CMP #$01
BNE +IsPaused
-
LDA soft2001
ORA #%11100000
STA soft2001
JSR GamePadCheck
LDA gamepad
AND #%00001000
BEQ -
LDA #$01
STA pause_game

+IsPaused
RTS
 
Last edited:

Jonny

Well-known member
Nice work dude. Shame that the SFX didn't work. I'll have a go with that myself too.

I take it this goes with another custom script (pause_game) to freeze the objects?
 

Jonny

Well-known member
I've been trying to figure out how this pauses the gameplay without doing anything to the object handling... so, does the loop (-) freeze everything where it is?
 

ronin1011

Member
Hey quick question. @Jonny @9Panzer I am trying to get this to work with the shooter module. I made a new user variable called pause_game with an initial value of 0. I made a whole new script and named it PauseGame.asm and pasted in that code from above. then I added a command input command to run the script when the player presses start in the main game. and it doesn't work for me.
Any ideas what I did wrong?
 

Jonny

Well-known member
Looks like pausing on shooter is different, maybe bacause of auto scroll, honestly don't know but there's a couple of treads about it...
Here's one...

 

ronin1011

Member
Looks like pausing on shooter is different, maybe bacause of auto scroll, honestly don't know but there's a couple of treads about it...
Here's one...

Thanks @Jonny
 

offparkway

Member
Yup @Jonny literally just freezes everything. The JSR GamePadCheck is the only thing that will work while its frozen lol
Awesome! I'm trying to implement this in a brawler game (scrolls right) and it also seems to have no effect for me either. I have it set to my start button in main game, and created a user variable "pause_game" set to 0 initial. Tried 1 as well. Any ideas?
 

offparkway

Member
OH! DAMN! @offparkway @ronin1011 I forgot the input - you need to set it to "release" instead of "push"
Does it have to function on the button release? I’m running into an issue where if my player dies and presses start to continue, the game continues in a paused state with no sprites on screen. You’d have to know to press start again.
 

9Panzer

Active member
@offparkway hmmm.. I was only able to get it to work on release. Maybe you just need to add a CMP to the input, Like check player health or maybe check the player action state?

Or maybe a different screen state that doesn't share the same input?
 
Top Bottom