Page 1 of 1

How to not hard code sprites

Posted: Thu Jun 10, 2021 8:41 am
by Copy_con^Z
Currently I’m hard coding my sprites. I know, it’s a pretty bad practice, and I’ll soon need to rework a lot of code. So instead of procrastinating I think I’d better get to it as soon as possible. My problem is I don’t have a clue where to start. Or perhaps I do, but I just underestimate the amount of code needed (since I currently with hard coded sprites don’t need any variables or tables). Could someone please guide me in the right direction?

Re: How to not hard code sprites

Posted: Thu Jun 10, 2021 12:20 pm
by freem
The wiki has a pretty nice article on this:
http://wiki.nesdev.com/w/index.php/Don% ... _addresses

The short version: use a byte as an index into your shadow OAM, and have any sprite drawing routines use that index instead of hardcoded addresses.

Re: How to not hard code sprites

Posted: Thu Jun 10, 2021 3:17 pm
by tokumaru
I posted an example metasprite subroutine recently: viewtopic.php?f=10&t=23011&p=272984#p272984

Re: How to not hard code sprites

Posted: Fri Jun 11, 2021 1:50 am
by Copy_con^Z
Thanks a lot!

It makes things a bit more clear to me.