Non-textbox based pause

Mugi

Member
this one is actually neat. it allows you to pause the game, but still control the character (change action states, but cant move)

https://youtu.be/nk5Lv5dFyNU

how this is made is really simple actually.
you need one variable (i call it "isPaused")

and one input script (i call it pause.asm)

Code:
    LDA isPaused
    BNE unpausegame
    LDA gameHandler
    ORA #%00100000 ;; objects bit
    STA gameHandler
    LDA #$01
    STA isPaused
    JMP theEnd
unpausegame:
    LDA gameHandler
    AND #%11011111 ;; objects bit
    STA gameHandler
    LDA #$00
    STA isPaused
theEnd:

place the above code into pause.asm and assign it to start button in MAIN GAME

then go to predraw and place the following in it (this is optional, but i suggest you use this to indicate that the game is paused.)

Code:
    LDA isPaused
    BNE +
    JMP isNotPaused
    +
    DrawSprite #$6C, #$78, #$70, #%00000001, spriteOffset
    UpdateSpritePointer
    DrawSprite #$76, #$78, #$71, #%00000001, spriteOffset
    UpdateSpritePointer
    DrawSprite #$80, #$78, #$72, #%00000001, spriteOffset
    UpdateSpritePointer
    DrawSprite #$8A, #$78, #$73, #%00000001, spriteOffset
    UpdateSpritePointer
    DrawSprite #$94, #$78, #$74, #%00000001, spriteOffset
    UpdateSpritePointer
isNotPaused:


this draws 5 sprites to the screen (in my case, the text P A U S E ) from the bottom left corner of your gameobjecttiles.bmp
to draw something different, change the 3rd value in the DrawSprite macro to match whatever you wish to draw.

enjoy.

Edit: if you dont like the fact that the player can respond to inputs, add the following to the beginning of your input scripts

LDA isPaused
BEQ +
RTS
+

that way when the game is paused, inputs are being ignored (just dont set that to the pause script :p)
 

Bucket Mouse

Active member
Fantastic work. This has been needed for quite some time.

If you don't want to use up five sprites, you can indicate when the game is paused with music. Like a tone that goes off when the Pause button is pressed. Better, the music could be muted during the Pause status.
 

Kasumi

New member
Another indication is darkening the entire screen by setting all the emphasis bits (the highest bits of $2001) at once. (Some clone systems don't simulate this.) Battle Kid does this.
 

Retrobuster

New member
THIS IS AWESOME and might solve a major problem with my game!

Edit: crap, I forgot I have to have different text for each screen so this actually won't work for me, but this is still awesome and way cleaner than a text box IMO.
 

dale_coop

Moderator
Staff member
Great ideas...
Here 's a "Pause.asm" script (using Bucket Mouse's paused sfx & Kasumi's darkened screen suggestions):

Code:
    LDA isPaused
    BNE unpausegame
    LDA gameHandler
    ORA #%00100000 ;; objects bit
    STA gameHandler
    LDA #$01
    STA isPaused
	;; we play the pause sfx:
	PlaySound #SND_PAUSE	
	;; we make the screen dark:
	LDA soft2001
	ORA #%11100000
	STA soft2001
	
    JMP thePauseEnd
unpausegame:
    LDA gameHandler
    AND #%11011111 ;; objects bit
    STA gameHandler
    LDA #$00
    STA isPaused
	;; we play the unpause sfx:
	PlaySound #SND_UNPAUSE
	;; we make the screen back normal:
	LDA soft2001
	AND #%00011111
	STA soft2001
thePauseEnd:
	RTS

Requires that you add 2 new sounds named "SND_PAUSE" & "SND_UNPAUSE" in the "Sounds > SFX" window.
 

Mugi

Member
The emphasis is a good idea, i already use that along with the screenfade but it never crossed my mind to actually put it here.

One could do whatever with this really, i wrote this kinda for making a traditional simple pause but the limit is basically just how much resources you wish to use for making it look / sound different.
 

Lother

Member
Another good way to indicate if the game is paused is by lowering the sound of the music too, and bringing back up when the game unpauses.
 
A few questions:

The screen dimming doesn't seem to do anything for me. Any idea why?

Is it possible to use graphics from our HUD to make the word paused? How would you indicate that you wanted to use those graphics instead?
^^ This would be really useful to me, because it would solve the issue I have of using a number for the equipped ability in my game instead of text.

Edit:
The dimming does actually work, but only when I run the game in Mesen. Not the default emulator.
 

Mugi

Member
the dimming is really subtle and depending on the palette you used on your stages, it can be hard to see (in my temple stage it's more or less not noticeable too.)

as for using hud tiles to write pause, technically i guess, but you will have to keep in mind that background tiles dont have transparency like sprites do.
im not really sure how to go with that, since i just used the drawsprite macro t odo mine, which is by far the most simple way to do it.
 

Kasumi

New member
Are you on a clone system, rather than an actual NES? A few don't simulate the emphasis bits. (Either at all, or just not doing setting them all at once correctly.)
 

drexegar

Member
Thanks a bunch mugi! Check this out:

my menu in nezumi is a monster/effect and all its code is in the input, I have a "ctrlstate" variable that disabled controls (for menu and cutscenes) and controls another variable that the monster constantly checks to change states giving you an illusion that its you controlling the menu! After that, the code controls which screen to jump to when the player presses A.

next time I start to use this it would be easy to make a menu to quit or exit the level or even make a yes or no question!
I can use the create an object to make the menu pop up in the pause script and then deactivate the monster when the game unpauses.



P.S. Whats even cool is now I get to learn how to draw sprites on the screen which I was looking for!
I got a crazy idea how to create those nice bonus screens that count your points at the end of a stage.
 

drexegar

Member
Lother said:
Another good way to indicate if the game is paused is by lowering the sound of the music too, and bringing back up when the game unpauses.

That would be hard, it way more easier in nesmaker just to create a pause theme like battle toads but then you would need to copy the variable of the music track first so it can restart the correct track when you unpause.
 

Mugi

Member
lowering the volume is near impossible in nes, it just doenst roll that way.
not to my knowledge atleast. i discussed this with my partner in crime but the issue is that the triangle channel has no volume control, it's either on or off, so this cant be reliably done.
 

Lother

Member
Mugi said:
lowering the volume is near impossible in nes, it just doenst roll that way.
not to my knowledge atleast. i discussed this with my partner in crime but the issue is that the triangle channel has no volume control, it's either on or off, so this cant be reliably done.

Ok, I didn't know about that problem. But at least that question is answered.
 

ZeGGamer1

New member
I got an error saying,

Routines\Basic\ModuleScripts\InputScripts\Pause.asm(3): Unknown label.
Routines\Basic\ModuleScripts\InputScripts\Pause.asm(9): Unknown label.
Routines\Basic\ModuleScripts\InputScripts\Pause.asm(23): Unknown label.
demo.txt written.

All I did was add dale's script into my input scripts and assign it to start. Am I missing something?
 
Top Bottom