Advertisement
NovaYoshi

camera

Jun 24th, 2015
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; subtract 5/8 of a screen if facing left or 3/8 if facing right
  2.   ldy PlayerDir ; 0 if right, 1 if left
  3.   lda PlayerPositionX+0
  4.   sub SubtractForDirectionsLow,y
  5.   sta Temp+0
  6.   lda PlayerPositionX+1
  7.   sbc SubtractForDirectionsHigh,y
  8.   sta Temp+1
  9.  
  10. ; subtract the current camera position
  11.   lda Temp+0
  12.   sub ScrollX+0
  13.   sta Temp+0
  14.   lda Temp+1
  15.   sbc ScrollX+1
  16.   sta Temp+1
  17.  
  18. ; divide by 4
  19.   lsr Temp+1
  20.   rol Temp+0
  21.   lsr Temp+1
  22.   rol Temp+0
  23.  
  24. ; add the current camera position.
  25.   lda Temp+0
  26.   add ScrollX+0
  27.   sta ScrollX+0
  28.   lda Temp+1
  29.   adc ScrollX+1
  30.   sta ScrollX+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement