First question, when you set the x/y of a sprite, where is the origin or the exact spot where this coordinate is set? Here's a pic for what I mean..
And second, when I'm checking for collision, how would I add an offset to the CMP so that the collision is pixel perfect? Here's my code for collisions:
And second, when I'm checking for collision, how would I add an offset to the CMP so that the collision is pixel perfect? Here's my code for collisions:
Code:
Collision1:
LDA ballx
CMP paddle1x ; here I need to add an offset
BCC Collision1Done
LDA bally
CMP paddle1ytop ; the paddle is two 8x8 sprites
BCC Collision1Done ; so one of these checks will need an offset
; depending on where the origin is
LDA bally
CMP paddle1ybot
BCS Collision1Done
LDA #$00
STA ballright
LDA #$01
STA ballleft
Collision1Done:
LDA ballx
CMP paddle1x ; here I need to add an offset
BCC Collision1Done
LDA bally
CMP paddle1ytop ; the paddle is two 8x8 sprites
BCC Collision1Done ; so one of these checks will need an offset
; depending on where the origin is
LDA bally
CMP paddle1ybot
BCS Collision1Done
LDA #$00
STA ballright
LDA #$01
STA ballleft
Collision1Done: