Changeset 27:3e4d8091268c


Ignore:
Timestamp:
Sep 1, 2013, 2:03:04 PM (7 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
rebase_source:
21a82e075217e88192688a8893f7c3935304b948
Message:

A werewolf always knows where she's going.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r25 r27  
    11"""Display a game area."""
     2
     3import math
    24
    35import pygame
     
    3234        self.space.add(self.protagonist_body, self.protagonist)
    3335
    34     def protagonist_move(self, dx, dy):
     36    def protagonist_move(self, dx, dy, angle):
     37        self.protagonist_body.angle = angle
    3538        self.protagonist_body.apply_impulse((dx * 2000, dy * 2000))
    3639
     
    4043                ScreenChange.post('menu')
    4144            elif ev.key == pygame.locals.K_UP:
    42                 self.protagonist_move(0, 1)
     45                self.protagonist_move(0, 1, math.pi / 2)
    4346            elif ev.key == pygame.locals.K_DOWN:
    44                 self.protagonist_move(0, -1)
     47                self.protagonist_move(0, -1, -math.pi / 2)
    4548            elif ev.key == pygame.locals.K_LEFT:
    46                 self.protagonist_move(-1, 0)
     49                self.protagonist_move(-1, 0, math.pi)
    4750            elif ev.key == pygame.locals.K_RIGHT:
    48                 self.protagonist_move(1, 0)
     51                self.protagonist_move(1, 0, 0)
    4952
    5053    def render(self, surface):
Note: See TracChangeset for help on using the changeset viewer.