i fixed the YT vid link. Edit the post to view the proper code to use, there.
otherwise, my hunch is that you're using screen coordinates somewhere vs world coordinates. see
ScreenToWorldX/Y() concerning the use of
SetViewOffset().
Draw is going to work as expected but your Ray, for example, needs World Coordinates to be accurate.
i only briefly skimmed your code and i do see:
vecn1=GetSpriteX(1)+30-GetViewOffsetX()
vect2=GetSpriteY(1)+60-GetViewOffsetY()
vect3=GetSpriteX(1)+30-GetViewOffsetX()
vect4=GetSpriteY(1)+60-GetViewOffsetY()
and still feel your using World Coords where proper will resolve the issue.