Disabling a Screen Sides

Is there any way (Code) to disable one side of the screen from sending player to next screen? In particular, when making side scroller, jumping from high platforms makes player jump to screen above current screen. I'd like to prevent this from happening by disabling the top of a screen from moving me to next screen.
 

Attachments

  • game-50.png
    game-50.png
    2.5 KB · Views: 6,688

dale_coop

Moderator
Staff member
Yes, you can disable it. Joe showed that in the plateform pi tutorial.
In the handleBounds_plateform_Simple.asm script, search for « BOUNDARIES ». There are comments, about that « player top boundaries » and even « bottom
Bonsoir ndaries » as death.
 
I must have missed it Which of the pi tutorials was it on. I do recall the part about the bottom screen death stuff but not about the top screen. I'll try your suggestion and look at the tutorial again. Thanks Dale.
 
Dale it worked as you described. You seem to be real good with the code. Now do you think I can add code to have screen check if ladder and player are touching top of screen and if so treat top as a" lead to above map screen". Tried doing it with a warp tile at top of ladder, but didn't quite work as I hoped.
 

dale_coop

Moderator
Staff member
I am not so good at code (in NESMaker). Like you, I try a lot of things (inspired by other lines of codes), and see if the result is what I expected (...or not) :p

And of course, my bible is the tutorial videos, I watch them each time I have a doubt or I can’t remember something)

For the boundaries and ladder, I had the same problem with my tests. I didn’t search more deeply about that, but yes it might be possible to check if the player is on a ladder (I will take a look again tonight).

Or maybe Joe (if he read these lines) would be a better help for us on that <3
 

dale_coop

Moderator
Staff member
Maybe something like that...
The current script you have :
Code:
playerIsNotHurtForTopUpdate:
	
	;;;; TO USE TOP AS A BOUNDARY, UNCOMMENT THESE LINES
	;;; == TOP IS A BOUNDARY
	LDA #$00
	STA Object_v_speed_hi,x
	STA Object_v_speed_lo,x
	LDA #$02
	STA temp
	RTS
	;;;;=======END TOP IS A BOUNDARY
	;;;;; TO USE TOP BOUNDS TO GO TO ABOVE MAP SCREEN, COMMENT OUT ABOVE AND UNCOMMENT THESE LINES
	;;;== TOP LEADS TO ABOVE MAP SCREEN
	;JSR updateScreenTop
	;LDA #$01
	;STA temp
	;rts
	;;;;====== END TOP LEADS TO ABOVE MAP SCREEN.


Modifications to check if player is on a ladder :

Code:
playerIsNotHurtForTopUpdate:
	
	;;;; TO USE TOP AS A BOUNDARY, UNCOMMENT THESE LINES
	;;; == TOP IS A BOUNDARY
	LDA onLadder
	BNE playerIsOnLadderForTopUpdate
	LDA #$00
	STA Object_v_speed_hi,x
	STA Object_v_speed_lo,x
	LDA #$02
	STA temp
	RTS
playerIsOnLadderForTopUpdate:	
	JSR updateScreenTop
	LDA #$01
	STA temp
	RTS	
	;;;;=======END TOP IS A BOUNDARY
	;;;;; TO USE TOP BOUNDS TO GO TO ABOVE MAP SCREEN, COMMENT OUT ABOVE AND UNCOMMENT THESE LINES
	;;;== TOP LEADS TO ABOVE MAP SCREEN
	;JSR updateScreenTop
	;LDA #$01
	;STA temp
	;rts
	;;;;====== END TOP LEADS TO ABOVE MAP SCREEN.

I think it should work
 
Dale I have confirmed your new code works. Nice. You Rock. I knew there had to be a way to tell it to check if you're on a ladder, just wasn't sure how to code it, but knew it have a BNE in there.
 

dale_coop

Moderator
Staff member
In fact, when I read the code I wrote, I don’t understand why it works using BNE. I wanted to check on player is onLadder or not, so if it’s true (1) or false (0).
Following that logic, I should have used a BEQ (and called my subroutine when onLadder is 1)
This morning, reading the code, cant figure out why it is working as it.
 

RadJunk

Administrator
Staff member
It works because:

You are checking the variable onLadder. The var onLadder gets set to 1 if you are on a ladder, but is set to 0 if you are not on a ladder, if you are using the platform scripts.

So if onLadder is NOT equal to zero (bne = branch if not equal), thats when you want to do ladder code (go up a screen). Otherwise it waa equal to zeeo, thus not on a ladder, which means you want it to *stop* in this case.

Btw - I’m very excited to see people already helping each other with code!!!!!! THIS demonstrates why the ‘can NESmaker do xyz’ is such a hard question. The users themselves are going to completely blow the lid off of what can be done with it!!! :)
 

dale_coop

Moderator
Staff member
Of thank you Joe, I understand better now the BNE and the onLadder variable

Yes, learning the basis... it’s not a big help, just small codes, for now. But it’s a start ;)
 

darkhog

New member
Really cool! May I use this code once I get access to NM? Planning to buy it in August as a late b-day gift for myself (my b-day is 27 July) and I was looking into making up/down screen only change if player is on a ladder.
 

dale_coop

Moderator
Staff member
Of course you can, darkhog. It's a share and help each other community. It's how I consider NESMakers.
 

dale_coop

Moderator
Staff member
Completely, now there are 4 bound scripts (look at the scripts assign in the « Project Script > Script Settings »... one for every screen edge bound).
 
Top Bottom