projects
/
koperkapel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0f2d2e9
)
Center display around our hero(es)
author
Neil
<neil@dip.sun.ac.za>
Sat, 5 Mar 2016 06:23:12 +0000
(08:23 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sat, 5 Mar 2016 06:23:12 +0000
(08:23 +0200)
koperkapel/scenes/level.py
patch
|
blob
|
history
diff --git
a/koperkapel/scenes/level.py
b/koperkapel/scenes/level.py
index a800ba0d842d0f5c3d130b16acbef92f6c0aa958..9dd8b61e3d7958ab67f7f25ae62b9467de770c7a 100644
(file)
--- a/
koperkapel/scenes/level.py
+++ b/
koperkapel/scenes/level.py
@@
-62,16
+62,18
@@
class GameLevelScene(BaseLevelScene):
def enter(self, world):
super().enter(world)
self._roaches = self.actors.add_layer("roaches", level=10)
def enter(self, world):
super().enter(world)
self._roaches = self.actors.add_layer("roaches", level=10)
- self._init_roaches(world.roaches)
+
return
self._init_roaches(world.roaches)
def _init_roaches(self, roaches):
def _init_roaches(self, roaches):
- x, y = self._level.start_pos
for roach in roaches:
roach_actor = self._roaches.add(default_roaches.assemble(roach))
roach_actor.anchor = (0, 0)
for roach in roaches:
roach_actor = self._roaches.add(default_roaches.assemble(roach))
roach_actor.anchor = (0, 0)
- roach_actor.pos = (x * TILE_SIZE, y * TILE_SIZE)
+ roach_actor.pos = (WIDTH // 2, HEIGHT // 2)
+ x, y = self._level.start_pos
self._set_pos(x, y)
self._level_layer = 'floor'
self._set_pos(x, y)
self._level_layer = 'floor'
+ # Fix viewport offset
+ return [MoveViewportEvent((x * TILE_SIZE - WIDTH // 2, y * TILE_SIZE - HEIGHT // 2))]
def _set_pos(self, x, y):
self._player_pos = (x, y)
def _set_pos(self, x, y):
self._player_pos = (x, y)