Advertisement
pipsqueaker117

redSquare.py

Nov 7th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #redSquare.py
  2. '''
  3. Created on Nov 6, 2012
  4.  
  5. @author: pipsqueakery
  6. '''
  7. class redCubie:
  8. def __init__(self, xpos, ypos, mass = 1):
  9. self.x = xpos
  10. self.y = ypos
  11. self.dy, self.dx = 0, 0
  12. self.width, self.height = 10, 10
  13. self.mass = mass
  14.  
  15. def _move(self, dx, dy):
  16. self.dx = dx
  17. self.dy = dy
  18. self.x += dx
  19. self.y += dy
  20.  
  21. def move(self, desx, desy):
  22. if desx < self.x:
  23. self.x -= 1
  24. elif desx > self.x:
  25. self.x +=1
  26. elif desx == self.x:
  27. pass
  28.  
  29. if desy < self.y:
  30. self.y -= 1
  31. elif desy > self.y:
  32. self.y += 1
  33. elif desy == self.y:
  34. pass
  35.  
  36. def returnRect(self):
  37. return (self.x, self.y, self.width, self.height)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement