I really really want to make NES games. I have lots of ideas for RPG's fleshed out on paper, and have designed pen and paper games before, but my true love are video games. I tried using the Nerdy Nights approach but I had a lot of trouble retaining any of the information I was looking at. I expressed my dire exasperation to KHAN Games one day and he offered to help me out with some one on one internet time and some personalized lessons.
I wanted to keep a record of what I am learning here. Please note that so far, while this method is working for me, it might not work for everyone else! Khan told me to say that if anyone is interested in these lessons, to PM him for the files.
I HAVE NO IDEA WHAT WEEK IT IS ANYMORE: I've been busy. Let me first say though that Assembly is really hard, and KHAN has been really a lifeline in the development of this game. The sprite is now nearly fully functional. All that needs to be done is to allow him to climb down ladders, probably will be most tiles though first as me and KHAN have to kink out the collision code still. I redesigned the level so it looked better, and added a status bar to the top!
WEEK FOUR: JUMPING SPRITES AND CODE CONSOLIDATION (FLAGS, TIMERS, & REGISTERS)
This week, I used my knowledge of subroutines to write and make some more to make my character jump. Earlier I had posted in the brewery with a question, at my first attempt at writing a subroutine without week 4's lesson in my possesion. I couldnt figure out why my routine wouldnt make my sprite jump, though through the use of timers, I was able to figure out how to make the sprites wait till they got to a certian y posistion and come back down. You can read all about that here
http://nintendoage.com/forum/messageview.cfm?catid=22&th...
We also went over how consolidate code, I dont feel as comfortable converting all my code yet since I understand it in longform, but I think I get the main concept. Apart from the A register that I've been using so far, the NES has 2 other registers it can track, X & Y. This means there are 3 registers so I can use more than one register to consildate my code. Right now, it kind of looks like this:
SampleRoutine:
LDA $0300
CLC
ADC #$01
STA $0300
LDA $0304
CLC
ADC #$01
STA $0304
LDA $0308
CLC
ADC #$01
STA $0308
LDA $030C
CLC
ADC #$01
STA $030C
RTS
But with registers and subroutines, we can consolidate that and make a loop where we assign the vertical pos to the x register and incriment it 4 times.
SampleRoutine:
LDX #$00
.Loop:
LDA $0300,x
CLC
ADC #$01
STA $0300,x
INX
INX
INX
INX
CPX #$10
BNE .Loop
RTS
What kind of makes this stuff so confusing is that this language of assembly is miserable. I'm taking python classes on the weekend and I am now at least sure after I master assembly python will be a piss in the pond
WEEK THREE: Subroutines Subroutines Subroutines:
This week was probably the most challenging of the lessons so far. My task was to animate my sprite so that it would walk foward convincingly with the little sprite animations I drew. I had to animate my sprite to walk right & left, and then for homework I had to get my guy to swing his sword with the B button.
Here is the Subroutine I wrote to animate the walking.
AnimateSpriteRight: ;title of our subroutine (named very obviously so we can find it later)
LDA RunTimer ;load RunTimer variable
CMP #$08 ;compare to $08
BCC .Frame1 ;if it's less than $08, branch to .Frame1
CMP #$10 ;compare to $10
BCC .Frame2 ;if it's less than $10, branch to .Frame2
CMP #$18 ;compare to $18
BCC .Frame3 ;if it's less than $18, branch to .Frame3
CMP #$20 ;compare to $20
BCC .Reset ;if it's less than $20, branch to .Reset
RTS ;it will only get to this "RTS" if it is $20 or greater
.Frame1:
INC RunTimer ;constantly increment the RunTimer variable every frame
LDA #$00 ;replacing the tiles of our sprites
STA $0301
LDA #$01
STA $0305
LDA #$02
STA $0309
LDA #$10
STA $030D
LDA #$11
STA $0311
LDA #$12
STA $0315
RTS
.Frame2:
INC RunTimer ;same as .Frame1, but with different tiles. It only gets to here
LDA #$03 ;when the timer variable is at a different value.
STA $0301
LDA #$04
STA $0305
LDA #$05
STA $0309
LDA #$13
STA $030D
LDA #$14
STA $0311
LDA #$15
STA $0315
RTS
.Frame3:
LDA #$06
STA $0301
LDA #$07
STA $0305
LDA #$08
STA $0309
LDA #$16
STA $030D
LDA #$17
STA $0311
LDA #$18
STA $0315
INC RunTimer
RTS
.Reset: ;when it makes it down to the .Reset subroutine (the timer is between $19
LDA #$00 ;and $20, right?) it resets the variable to $00 and starts over!
STA RunTimer
RTS
And Then I learned by using Variables, it was super easy to finish my homework! Was able to map the B button using the same techniques I learned to swing a sword. Happy with the progress this week!
I also picked up the book learning assembly step by step that was reccomended by other members on here, so far, really enjoying it! I am hoping that we get to collision next week...
WEEK TWO: SPRITES AND BACKGROUNDS.
Another Update: I worked on my sprites some more. Happy with the way stuff is coming.
Update: I finished my lesson for this week. This time we built a background using tools Shiru and Zzap made. This was really challenging, but it cemented in my mind how hex numbers work, and also taught me the joys of the programmers calc on windows 7.
The most challenging part was getting all 4 sprites to move with the controller, but it was good for me to go over the work from last week's lesson as I think it was important for cementing that way of thinking, before we get heavy into programming next week.
Since I finished the lesson the day I got it, my goal for this week is to beautify and embelish these background tiles a bit and play some Wind Waker HD.
There should be an updated learning.nes file attached but its not showing up on the post, mayhaps a mod can help?
END OF UPDATE.
I havent gotten the next week's lesson yet, but I have started work on it. I drew some sprites in TLP.
(my gf advised me not to post to much, but people here wouldnt steal would they? I have way more I worked on tonight)
And I also drew out a level, KHAN said it was a little complicated, but we will make do
I still have to make a sample background tile so we can put that on a screen and have my sprite walk around it! Exciting!
Most importantly, I have a concept and name for my game now, its called,
Adversary. Got the name from member arch 8ngel.
WEEK ONE: GETTING SOMETHING ON THE SCREEN AND MOVING IT AROUND.
So my goal for the first week was to draw a sprite, get it on the screen, and then move it around using a controller.
I got Tile Layer Pro and drew up this little sprite. Later, I got it to move around on the screen after writing my first subroutine!
MoveSpriteUp:
LDA UpHeld
CMP #$01
BNE .End
LDA $0300
SEC
SBC #$01
STA $0300
.End:
RTS
That was exciting! I feel like I am starting to understand what these things are doing now. The bottom is the final product, I was also able to make this .nes file work on my Everdrive!
I would post the rom file I made but I dont want to get in trouble
Edit: I've been told I wont get in trouble. Rom file is attached!
NEXT WEEK: BACKGROUNDS!