Esempio n. 1
0
File: Worm.py Progetto: Peaker/pyun
    def forward(self, speed):
        self._old_eyes = self._eyes

        self._forward_body(speed)
        
        self._eyes = []
        if self.net_config.FOG_ENABLED:
            self._eyes = [forwarded_pos(self.position, self.angle-30, self.net_config.DIAMETER/2),
                          forwarded_pos(self.position, self.angle+30, self.net_config.DIAMETER/2)]
Esempio n. 2
0
 def forward(self, surface):
     count = self.speed
     while count > 0:
         MAX_SINGLE_MOVEMENT = 3
         self.position = forwarded_pos(self.position, self.angle, min(count, MAX_SINGLE_MOVEMENT))
         count -= MAX_SINGLE_MOVEMENT
         pygame.draw.circle(surface, self.color, map(int, self.position),
                            int(self.diameter/2))
Esempio n. 3
0
File: Worm.py Progetto: Peaker/pyun
    def _forward(self, delta):
        self.position = forwarded_pos(self.position, self.angle, delta)

        if self._collides_with_wall():
            raise Collision()

        self._forward_current(delta)

        # The following allows detection of collisions only with
        # things we stopped colliding with and re-collided with
        
        new_collisions = set(self._worm_area.canvas.collisions(self._current_circle))
        if new_collisions - self._last_collisions - set([self._current_circle]):
            raise Collision()

        self._last_collisions = new_collisions