Changeset 59:b412704a6737


Ignore:
Timestamp:
Sep 1, 2013, 4:48:55 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
rebase_source:
3bd80a9f9058faf491a2d5fd87ee10ce12ff1dd6
Message:

Start of game object stuff.

Location:
nagslang
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r58 r59  
    66import pymunk.pygame_util
    77
     8from nagslang.resources import resources
     9from nagslang.game_object import (
     10    GameObject, SingleShapePhysicser, ImageRenderer)
    811from nagslang.screens.base import Screen
    912from nagslang.level import Level
     
    3033
    3134
    32 class Protagonist(object):
     35class Protagonist(GameObject):
    3336    def __init__(self, position):
    3437        self.body = pymunk.Body(10, 10000)
     
    4043        self.shape.friction = 10.0
    4144
     45        super(Protagonist, self).__init__(
     46            ImageRenderer(resources.get_image('creatures', 'werewolf_1.png')),
     47            SingleShapePhysicser(self.shape))
     48
    4249        self.go_human()
    43 
    44     def add_space(self, space):
    45         space.add(self.body, self.shape)
    4650
    4751    def velocity_func(self, body, gravity, damping, dt):
    4852        return pymunk.Body.update_velocity(body, gravity, self.damping, dt)
    4953
    50     def render(self, surface):
     54    def render_TODO(self, surface):
    5155        if self.werewolf:
    5256            pos = pymunk.pygame_util.to_pygame(self.body.position, surface)
     
    121125    def add_protagonist(self):
    122126        self.protagonist = Protagonist((400, 300))
    123         self.protagonist.add_space(self.space)
     127        self.protagonist.add_to_space(self.space)
    124128
    125129    def handle_event(self, ev):
Note: See TracChangeset for help on using the changeset viewer.