Changeset 43:abbc9ada8dc4


Ignore:
Timestamp:
Apr 3, 2011, 6:42:55 PM (9 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Message:

Enemies must fall

Location:
skaapsteker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/levelscene.py

    r42 r43  
    1414        self._world = physics.World()
    1515
     16        # hackity, hack, hack
     17        for sprite in self._level.enemies:
     18            self._world.add(sprite)
     19
    1620    def draw(self, screen_surface):
    1721        self._world.update()
  • skaapsteker/physics.py

    r39 r43  
    2020        self.velocity = (0.0, 0.0)
    2121        self.rect = pygame.Rect(0, 0, 10, 10) # sub-classes should override
     22        self.image = pygame.Surface((10, 10))
     23        self.image.fill((0, 0, 200))
    2224
    2325    def deltav(self, dv):
     
    3436        v_x, v_y = self.velocity
    3537        d_x, d_y = v_x * dt, v_y * dt
    36         self.rect.move(d_x, d_y)
     38        self.rect.move_ip(d_x, d_y)
    3739
    3840
    3941class World(object):
    4042
    41     GRAVITY = -9.8 # m/s^2
     43    GRAVITY = 9.8 # m/s^2
    4244
    4345    def __init__(self):
Note: See TracChangeset for help on using the changeset viewer.