from pgzero.constants import keys, mouse
from pgzero.actor import Actor
-from ..actors.buttons import TextButton, ImageButton
+from ..actors.buttons import ImageButton
from ..constants import WIDTH, HEIGHT
from ..roaches import big_roaches
+from ..serums import big_serums
from ..vehicles.base import Vehicle
from .base import Scene, ChangeSceneEvent
def __init__(self):
super().__init__()
+ self._outside_roach_pos = 0
+ self._inventory_pos = 0
self._roaches = self.actors.add_layer("roaches", level=10)
+ self._serums = self.actors.add_layer("serums", level=10)
self._pads = self.actors.add_layer("pads", level=5)
self._seats = self.actors.add_layer("seats", level=5)
self._buttons = self.actors.add_layer("buttons", level=6)
self._init_bg()
self._init_seats()
self._init_roaches(world.roaches)
+ self._update_serums(world.serums)
def _init_bg(self):
self.actors.default.add(self._vehicle.background)
if i < len(self._seats):
roach_actor.pos = self._seats[i].pos
+ def _update_serums(self, serums):
+ self._serums.clear()
+ if not serums:
+ return
+ self._inventory_pos %= len(serums)
+ serum_actor = self._serums.add(
+ big_serums.assemble(serums[self._inventory_pos]))
+ serum_actor.pos = self._inventory_pad.center
+
def _init_pads(self):
self._roach_pad = self._pads.add(
Actor("roach_management/roach_pad", anchor=("left", "bottom")))
(TOOLBAR_LEFT_X, TOOLBAR_TOP_Y), self._eject_roach)
def _roach_left(self):
- print("Cycle outside roaches left.")
+ self._outside_roach_pos -= 1
def _roach_right(self):
- print("Cycle outside roaches right.")
+ self._outside_roach_pos += 1
def _inventory_left(self):
- print("Cycle inventory left.")
+ self._inventory_pos -= 1
def _inventory_right(self):
- print("Cycle inventory right.")
+ self._inventory_pos += 1
def _eject_roach(self):
print("Eject roach.")
+ def update(self, world, dt):
+ self._update_serums(world.serums)
+
def on_key_down(self, key, mod, unicode):
if key == keys.ESCAPE:
from .menu import MenuScene