Sky's the limit (sadly)

Dirk

Member
Hi,

when my player is at the top of the screen and jumps he hits his head and falls down again. I have seen someone make a transition to another screen, so you can eg. really climb on top of a tree.
That's not what I want. I would like to be able to jump out of the top of screen like in some Super Mario games.
Has anybody achieved this yet or knows how to do it?
 

dale_coop

Moderator
Staff member
In the Handle Bounds script, search for “BOUNDARIES” you need to uncomment some lines (it’s explained in the code).

Sorry for not being precise (I am not at home).
 

Dirk

Member
Ok, I tested it, but it doesn't work like I hoped it would.
I commented some code and when I jumped out of the top it showed a blank screen, falling down resulted in death because I touched the lower part of the screen.
I commented around again and now my character jumps out of the screen without the screen changing, like I wanted, but he dies. I can't tell if he immediately dies or if he dies like before when he touched the lower bound of the blank screen, that doesn't get displayed now.

I hope you can understand what I wanted to express, Halloween still has my mind a bit clouded^^

EDIT: I commented out that the lower boundary causes death, but now my player won't reenter the correct screen, but will fall down blank screens until he reaches some part of my levels ^^
 

MistSonata

Moderator
What's happening is that in NESmaker, the vertical values of objects go from 0 to 255, where 0 represents the highest your character can go and 255 represents the lowest. However, when you take the 8 bit value of 0 and subtract 1, you don't get -1. Instead, you get 255. This is why you're dying when you go too high on the screen, you're looping back around and appearing at the bottom of the screen, and when you're at the bottom of the screen, the game reads that as you falling into a pit, even though you technically didn't.

In order to achieve what you want, you'll need to modify the physics script and the boundary script to recognize what's called a "page boundary". Essentially, the player object needs a separate variable to store which "page" it's on, and when you calculate the player's new position in the physics script, it needs to increase or decrease the page so that when the boundary script checks if you've fallen into a pit, you can have it check the page value first to make sure you're not just up in the air above the playable area.

You might also have to modify the sprite drawing script to account for the page boundary, too...
 

Dirk

Member
Thank you for the explanation! Everything you said sounds very familiar and I should have known it already :oops:

Also thank you for the road map on how to get the effect I want. Sounds like a lot of work. I think I will postpone my efforts until I have a better understanding of ASM. I hope I'll learn a lot with Joe's upcoming tutorials for beginner, intermediate and expert.
 
Top Bottom