[4.5.X] Quick tutorial: Adding the "skip top object collision" flag to use when crouching

SciNEStist

Well-known member
for my update to "Get It Together" I was able to check for low ceilings and prevent changing into a larger object. heres how it's done:

Code:
;ASSUMES x IS OBJECT YOU WANT TO TEST ABOVE
LDA Object_x_hi,x
STA temp1
LDA Object_y_hi,x
SBC #$08 ; look up 8 pixels higher
STA temp2
CheckCollisionPoint temp1, temp2, #$01, #$00 ; checks top left
BNE +
    JMP +skipaction ; it hit something, so jump ahead
+
LDA temp1
ADC ObjectWidth,x ; move left the width of the object. you can substitute this for #$10 for 16 pixels
STA temp1
CheckCollisionPoint temp1, temp2, #$01, #$00 ; checks top right
BNE +
    JMP +skipaction ; it hit something, so jump ahead
+
;ALL CLEAR, NOTHING HIT! PUT WHAT YOU WANT TO HAPPEN BELOW THIS LINE


+skipaction
RTS
 
Last edited:
Top Bottom