Disabling a Screen Sides

User avatar
dark_crow_66
Posts: 100
Joined: Wed Apr 18, 2018 1:59 pm

Disabling a Screen Sides

Post by dark_crow_66 » Mon Jul 02, 2018 3:20 am

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.55 KiB) Viewed 875 times
User avatar
dale_coop
Posts: 1604
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Disabling a Screen Sides

Post by dale_coop » Mon Jul 02, 2018 7:30 am

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.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dark_crow_66
Posts: 100
Joined: Wed Apr 18, 2018 1:59 pm

Re: Disabling a Screen Sides

Post by dark_crow_66 » Tue Jul 03, 2018 2:57 am

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.
User avatar
dark_crow_66
Posts: 100
Joined: Wed Apr 18, 2018 1:59 pm

Re: Disabling a Screen Sides

Post by dark_crow_66 » Tue Jul 03, 2018 3:40 am

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.
User avatar
dale_coop
Posts: 1604
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Disabling a Screen Sides

Post by dale_coop » Tue Jul 03, 2018 8:49 am

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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1604
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Disabling a Screen Sides

Post by dale_coop » Tue Jul 03, 2018 11:36 am

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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dark_crow_66
Posts: 100
Joined: Wed Apr 18, 2018 1:59 pm

Re: Disabling a Screen Sides

Post by dark_crow_66 » Wed Jul 04, 2018 2:44 am

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.
User avatar
dale_coop
Posts: 1604
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Disabling a Screen Sides

Post by dale_coop » Wed Jul 04, 2018 6:44 am

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.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
TheNew8bitHeroes
Posts: 324
Joined: Fri Feb 16, 2018 9:24 pm
Location: Sarasota, FL
Contact:

Re: Disabling a Screen Sides

Post by TheNew8bitHeroes » Wed Jul 04, 2018 12:15 pm

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!!! :-)
User avatar
dale_coop
Posts: 1604
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Disabling a Screen Sides

Post by dale_coop » Wed Jul 04, 2018 12:40 pm

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 ;)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply