8x16 and whatever else unreg wants to know

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

When you're "camera" moves the screen, once you hit the nametable, how will you scroll to the right more? To do that, you must set the main nametable to be the one you're scrolled onto all the way, because to scroll across it more, it has to be the main table since you can't scroll anymore if you set the scroll to the max.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

Image
In my head the top left of the screen/camera can make it to 255. Then wouldn't almost all of NameTable 1 be shown?
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

Then how do you scroll to the right of that nametable? By setting it as the main one, resetting your scroll, and then scrolling right again. I wish I could make gif's, as it'd be way easier to show than tell. :)
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

3gengames wrote:Then how do you scroll to the right of that nametable?
I dont want to scroll to the right of NameTable 1 right now.
3gengames wrote:I wish I could make gif's, as it'd be way easier to show than tell. :)
oooh well I just used bunnyboy's graphic from this page. Just copied it over from there to my web account server... You can make gif's. Try the gimp! :)
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

Okay, as long as you don't need to scroll to the right of the 2nd nametable, it should be fine then. :)
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

Ah ha! Ok, thanks 3gengames! :D
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

unregistered wrote:Ah ha! Ok, thanks 3gengames! :D
Yep, and I have failed at making that GIF, heh. And same goes for the bottom, as long as you don't need to scroll past there, you're fine. :) Good luck.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

3gengames, thank you. :)
---

For sbc,

Code: Select all

Operation: A - M - -C -> A
Note: -C = Borrow
I have clc right before sbc... but since -C is the Borrow it seems, to me, that it is really ¬C. So my idea is to sec instead. (I'm trying to clear the borrow.) What do yall think?
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

Set subtract. Clear Add.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

3gengames wrote:Set subtract. Clear Add.
Rock (yes)! :D Thanks!
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

Praise God!! :D The screen scrolls right when our lady travels right close to the edge of the screen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you so much tepples and 3gengames and tokumaru and booker and Kasumi and Bregalad and Shiru! :D

I also have a question to ask: How do I make it so that the screen scrollls over the same speed as our lady travels? Right now she reaches the right side of the screen before she makes it to the end of NameTable 1. :?
Last edited by unregistered on Sun Aug 28, 2011 9:11 pm, edited 1 time in total.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Make a game object called the "camera" and fix the scroll position relative to it.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

tepples wrote:Make a game object called the "camera" and fix the scroll position relative to it.
Ok I created a byte called "Camera". Now there's 2 variables that are similar to Camera: oX and scroll. I should move both the screen and the character by Camera, right? Should Camera be 16bits so it can keep track of what nametable it is on? Here is good camera discussion. :)
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Your camera coordinates should be 16-bit. /since your game only scrolls horizontally, you only need a "CameraX" variable, because "CameraY" would always be 0.

You should make the camera follow the player using whatever logic you see fit. Some games move the camera by the same amount as the player every frame, others move it only if the player has gone past a certain point. No matter what rules you use, the camera must always follow the player.

The coordinates of the camera can be directly used to set the scroll, you don't need more variables for that. Another important thing is that the coordinates of the sprites must be calculated by subtracting the coordinates of the objects by the coordinates of the camera. With scrolling, object coordinates can no longer be used directly as sprite coordinates, because they are relative to the level and not the screen. That subtraction does the convertion from level coordinates to screen coordinates.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

tokumaru wrote:Your camera coordinates should be 16-bit. /since your game only scrolls horizontally, you only need a "CameraX" variable, because "CameraY" would always be 0.

You should make the camera follow the player using whatever logic you see fit. Some games move the camera by the same amount as the player every frame, others move it only if the player has gone past a certain point. No matter what rules you use, the camera must always follow the player.

The coordinates of the camera can be directly used to set the scroll, you don't need more variables for that. Another important thing is that the coordinates of the sprites must be calculated by subtracting the coordinates of the objects by the coordinates of the camera. With scrolling, object coordinates can no longer be used directly as sprite coordinates, because they are relative to the level and not the screen. That subtraction does the convertion from level coordinates to screen coordinates.
tokumaru, thank you! :D
Post Reply