Advertisement
GustavoDestroyer

Custom Camera Module - Pygame

Aug 9th, 2021
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. class Camera:
  2.     def __init__(self, Width, Height):
  3.         self.X = 0
  4.         self.Y = 0
  5.         self.AnchorX = 0.5
  6.         self.AnchorY = 0.5
  7.         self.Width = Width
  8.         self.Height = Height
  9.    
  10.     def anchorPoint(self, X, Y):
  11.         self.AnchorX = X
  12.         self.AnchorY = Y
  13.  
  14.     def translate(self, X, Y):
  15.         self.X = X
  16.         self.Y = Y
  17.    
  18.     def relative(self, X, Y):
  19.         return (self.Width * self.AnchorX) + self.X + X, (self.Height * self.AnchorY) + self.Y + Y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement