def frame(self, relative): self.relative.x, self.relative.y = relative self.screen_position_lastframe = self.screen_position self.screen_position += self.relative self.screen_position.x = limit(self.screen_position.x, 0, self.state.width) self.screen_position.y = limit(self.screen_position.y, 0, self.state.height)
def handleMovement(self): self.state.movement.momentum.x = limit(self.state.movement.momentum.x, -10, 10) self.state.movement.momentum.y = limit(self.state.movement.momentum.y, -10, 10) self.PhysicsGravity(self.state.movement) self.state.movement.position = self.state.movement.position + self.state.movement.momentum.scale( self.state.gametimeScale * self.state.lastFrameTime, True) self.collideScreen(self.state.movement.position)
def rotate_pitch(self, distance): self.dirty = True self.orientation.x += distance * self.pitch_speed self.orientation.x = limit(self.orientation.x, -90, 90)
def collideScreen(self): self.position.x = limit(self.position.x, 0, self.state.width) self.position.y = limit(self.position.y, 0, self.state.height)
def handleMovement(self): self.state.movement.momentum.x = limit(self.state.movement.momentum.x, -10, 10) self.state.movement.momentum.y = limit(self.state.movement.momentum.y, -10, 10) self.PhysicsGravity(self.state.movement) self.state.movement.position = self.state.movement.position + self.state.movement.momentum.scale(self.state.gametimeScale * self.state.lastFrameTime, True) self.collideScreen(self.state.movement.position)
def collideScreen(self, position): position.x = limit(position.x, 0, self.state.width) position.y = limit(position.y, 0, self.state.height)