Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 def rotate_pitch(self, distance):
     self.dirty = True
     self.orientation.x += distance * self.pitch_speed
     self.orientation.x = limit(self.orientation.x, -90, 90)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 def collideScreen(self, position):
     position.x = limit(position.x, 0, self.state.width)
     position.y = limit(position.y, 0, self.state.height)
Esempio n. 8
0
 def collideScreen(self, position):
     position.x = limit(position.x, 0, self.state.width)
     position.y = limit(position.y, 0, self.state.height)