Posted: Tue Nov 22, 2011 10:39 pm
I'm looking your code now. Do you mind if I make a pastebin of it and link it here? Others may be able to provide help if I can't. BTW, I had to do a little editing to get it working. (Adding tabs and stuff.) It's not a big deal in this case, but it may be worth finding a way to get the exact files off the computer in the future.
Is indeed what's included in the nerdy nights tutorial. Which does seem wrong. It should either be ball x > paddle1x, or it should say ball bounces RIGHT. But I want to get this working before I declare that.
There are a few things here you should change. Maybe this fill in the blank type of thing isn't a great way to learn. I can see what bunnyboy was trying to do, but sometimes there are better ways to do things that are just as easy to explain.
First off, this:
You're doing these same two checks again and again and again:
Check 1:
Check 2:
So how about putting ALL the code that needs those checks in between ONE branch and label?
Like so:
This saves space, and takes less time to execute since you never have to check something again that you already know the result of. Make sense?
You can even simplify this further, but that will have to wait.
I promise I'll write a little more later, and try as hard as I can to get the heart of the problem. But, I'm actually keeping people up with my typing right now.
Code: Select all
;;if ball x < paddle1x
;; if ball y > paddle y top
;; if ball y < paddle y bottom
;; bounce, ball now moving left
There are a few things here you should change. Maybe this fill in the blank type of thing isn't a great way to learn. I can see what bunnyboy was trying to do, but sometimes there are better ways to do things that are just as easy to explain.
First off, this:
Code: Select all
MovePaddle1ytop:
LDA buttons1
AND #%00001000
BEQ MovePaddle1ytopDone
;truncated
MovePaddle1ytopDone:
DownPaddle1ytop:
LDA buttons1
AND #%00000100
BEQ DownPaddle1ytopDone
;truncated
DownPaddle1ytopDone:
MovePaddle12:
LDA buttons1
AND #%00001000
BEQ MovePaddle12Done
;truncated
MovePaddle12Done:
DownPaddle12:
LDA buttons1
AND #%00000100
BEQ DownPaddle12Done
;truncated
DownPaddle12Done:
MovePaddle13:
LDA buttons1
AND #%00001000
BEQ MovePaddle13Done
;truncated
MovePaddle13Done:
DownPaddle13:
LDA buttons1
AND #%00000100
BEQ DownPaddle13Done
;truncated
DownPaddle13Done:
MovePaddle14:
LDA buttons1
AND #%00001000
BEQ MovePaddle14Done
;truncated
MovePaddle14Done:
DownPaddle14:
LDA buttons1
AND #%00000100
BEQ DownPaddle14Done
;truncated
DownPaddle14Done:
Check 1:
Code: Select all
LDA buttons1
AND #%00001000;Check if up is pressed
BEQ MovePaddle1ytopDone
;Do stuff
MovePaddle1ytopDone:
Code: Select all
LDA buttons1
AND #%00000100
BEQ DownPaddle1ytopDone
;Do stuff
DownPaddle1ytopDone:
Like so:
Code: Select all
MovePaddle1ytop:
LDA buttons1
AND #%00001000
BEQ MovePaddle1ytopDone
LDA paddle1ytop
SEC
SBC #$01
STA paddle1ytop
LDA paddle12
SEC
SBC #$01
STA paddle12
LDA paddle13
SEC
SBC #$01
STA paddle13
LDA paddle14
SEC
SBC #$01
STA paddle14
MovePaddle1ytopDone:
DownPaddle1ytop:
LDA buttons1
AND #%00000100
BEQ DownPaddle1ytopDone
LDA paddle1ytop
CLC
ADC #$01
STA paddle1ytop
LDA paddle12
CLC
ADC #$01
STA paddle12
LDA paddle13
CLC
ADC #$01
STA paddle13
LDA paddle14
CLC
ADC #$01
STA paddle14
DownPaddle1ytopDone:
You can even simplify this further, but that will have to wait.
I promise I'll write a little more later, and try as hard as I can to get the heart of the problem. But, I'm actually keeping people up with my typing right now.