Collision detection problem with my project.

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Collision detection problem with my project.

Post by tokumaru »

kikutano wrote:The sourcecode complete is here: https://pastebin.com/689fHti0
You're not setting up stuff before running the code in question... A doesn't hold the level index, it holds whatever the loop above got from bg_lvl_top_corner. You're also not setting a vram address via $2006, so it's whatever the code above left it as.

Also, with this method, tables aren't limited to 256 bytes anymore, so the table of pointers only needs to point to the beginning of each NT:

Code: Select all

LevelPointers:
  .dw bg_lvl_1_0, bg_lvl_2_0
If you put all those labels in the list, you'll be mixing partial name tables if you use indices that are not multiples of 4.

Another thing to consider is that my example code copies 1024 bytes to vram, because I assumed you'd be copying an NT and an AT together in one chunk, which doesn't seem to be the case. Well, there's nothing wrong with copying invalid AT data if you'll overwrite it with the correct data afterward, so I don't think you have to worry about it for now.
User avatar
kikutano
Posts: 115
Joined: Sat May 26, 2018 6:14 am
Location: Italy

Re: Collision detection problem with my project.

Post by kikutano »

Thanks a lot! :)
Post Reply