from direct.interval.LerpInterval import LerpFunctionInterval
from pmachines.items.background import Background
from pmachines.gui.sidepanel import SidePanel
+from pmachines.items.box import Box
+from pmachines.items.basketball import Basketball
+from pmachines.items.domino import Domino
from ya2.utils.cursor import MouseCursor
from ya2.p3d.gfx import P3dGfxMgr
from ya2.p3d.p3d import LibP3d
def _set_items(self):
self.items = []
self._test_items = []
+ if not self.__class__.json:
+ with open(self.__class__.filename) as f:
+ self.__class__.json = loads(f.read())
+ for item in self.__class__.json['start_items']:
+ args = {
+ 'world': self._world,
+ 'plane_node': self._mouse_plane_node,
+ 'cb_inst': self.cb_inst,
+ 'curr_bottom': self.current_bottom,
+ 'repos': self.repos,
+ 'count': item['count']}
+ if 'mass' in item:
+ args['mass'] = item['mass']
+ if 'friction' in item:
+ args['friction'] = item['friction']
+ self.items += [self.__code2class(item['class'])(**args)]
+
+ def __code2class(self, code):
+ return {
+ 'Box': Box,
+ 'Basketball': Basketball,
+ 'Domino': Domino
+ }[code]
def screenshot(self, task=None):
tex = Texture('screenshot')