Page 1 of 2

Disabling a Screen Sides

Posted: Mon Jul 02, 2018 3:20 am
by dark_crow_66
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.

Re: Disabling a Screen Sides

Posted: Mon Jul 02, 2018 7:30 am
by dale_coop
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.

Re: Disabling a Screen Sides

Posted: Tue Jul 03, 2018 2:57 am
by dark_crow_66
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.

Re: Disabling a Screen Sides

Posted: Tue Jul 03, 2018 3:40 am
by dark_crow_66
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.

Re: Disabling a Screen Sides

Posted: Tue Jul 03, 2018 8:49 am
by dale_coop
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

Re: Disabling a Screen Sides

Posted: Tue Jul 03, 2018 11:36 am
by dale_coop
Maybe something like that...
The current script you have :

Code: Select all

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: Select all

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

Re: Disabling a Screen Sides

Posted: Wed Jul 04, 2018 2:44 am
by dark_crow_66
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.

Re: Disabling a Screen Sides

Posted: Wed Jul 04, 2018 6:44 am
by dale_coop
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.

Re: Disabling a Screen Sides

Posted: Wed Jul 04, 2018 12:15 pm
by TheNew8bitHeroes
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!!! :-)

Re: Disabling a Screen Sides

Posted: Wed Jul 04, 2018 12:40 pm
by dale_coop
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 ;)