コード例 #1
0
ファイル: PEG_entity.py プロジェクト: chippermonky/mwgame3
 def setMouse(self):
     self.screenCrds = Vector2d(pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1])
     self.cursor = PEG_mainLoop.mainLoop().cam.convertCrds(self.screenCrds)
     self.cursor.x = PEG_helpers.truncateToMultiple(self.cursor.x, TILING_SIZE.x)
     self.cursor.y = PEG_helpers.truncateToMultiple(self.cursor.y, TILING_SIZE.y)
     if self.activeObject:
         self.activeObject.teleport(self.cursor)
コード例 #2
0
 def draw(self):
     if self.dir == "left":
         self.activeSurface = self.flipSurface
     else:
         self.activeSurface = self.mainSurface
                 
     frameNum = (PEG_helpers.truncateToMultiple(pygame.time.get_ticks(),self.frames[self.state][1])/self.frames[self.state][1])%len(self.frames[self.state][0])
     PEG_mainLoop.mainLoop().cam.drawOnScreen(self.activeSurface, self.pos-self.drawOffset, pygame.Rect(self.frames[self.state][0][frameNum].x, self.frames[self.state][0][frameNum].y,40,80))