Mercurial > nagslang
comparison nagslang/game_object.py @ 91:5c31b4d1851c
Remove NullPhysicser, since it looks like everything needs PHYSICS!!!
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 02 Sep 2013 08:36:46 +0200 |
parents | 11b0017b5e4b |
children | d6a49f0c1e6e |
comparison
equal
deleted
inserted
replaced
90:a8d83de5b460 | 91:5c31b4d1851c |
---|---|
35 def render_position(self, surface): | 35 def render_position(self, surface): |
36 raise NotImplementedError() | 36 raise NotImplementedError() |
37 | 37 |
38 def render_angle(self): | 38 def render_angle(self): |
39 raise NotImplementedError() | 39 raise NotImplementedError() |
40 | |
41 | |
42 class NullPhysicser(Physicser): | |
43 def add_to_space(self, space): | |
44 pass | |
45 | |
46 def remove_from_space(self, space): | |
47 pass | |
48 | |
49 def render_position(self): | |
50 return (0, 0) | |
51 | |
52 def render_angle(self): | |
53 return 0 | |
54 | 40 |
55 | 41 |
56 class SingleShapePhysicser(Physicser): | 42 class SingleShapePhysicser(Physicser): |
57 def __init__(self, shape): | 43 def __init__(self, shape): |
58 self._shape = shape | 44 self._shape = shape |
120 """A representation of a thing in the game world. | 106 """A representation of a thing in the game world. |
121 | 107 |
122 This has a rendery thing, physicsy things and maybe some other things. | 108 This has a rendery thing, physicsy things and maybe some other things. |
123 """ | 109 """ |
124 | 110 |
125 def __init__(self, renderer, physicser=None, puzzler=None): | 111 def __init__(self, renderer, physicser, puzzler=None): |
126 self.renderer = renderer | 112 self.renderer = renderer |
127 if physicser is None: | |
128 physicser = NullPhysicser() | |
129 self.physicser = physicser | 113 self.physicser = physicser |
130 self.puzzler = puzzler | 114 self.puzzler = puzzler |
131 | 115 |
132 def add_to_space(self, space): | 116 def add_to_space(self, space): |
133 self.physicser.add_to_space(space) | 117 self.physicser.add_to_space(space) |