From 3211f3f3adb5a6502db3580ffe70cda4b6834f3f Mon Sep 17 00:00:00 2001 From: Flavio Calva Date: Wed, 16 Feb 2022 19:04:48 +0100 Subject: [PATCH] domino+box scene --- pmachines/app.py | 2 +- pmachines/menu.py | 2 +- pmachines/scenes/scene_domino_box.py | 45 ++++++++++++++++++++++++++++ prj.org | 2 +- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 pmachines/scenes/scene_domino_box.py diff --git a/pmachines/app.py b/pmachines/app.py index 82208b2..1916d54 100755 --- a/pmachines/app.py +++ b/pmachines/app.py @@ -68,7 +68,7 @@ class PmachinesApp: member != Scene: scene_classes += [member] for cls in scene_classes: - scene = cls(BulletWorld(), None, True, False) + scene = cls(BulletWorld(), None, True, False, lambda: None) scene.screenshot() scene.destroy() exit() diff --git a/pmachines/menu.py b/pmachines/menu.py index 96cb99e..9dd67e5 100644 --- a/pmachines/menu.py +++ b/pmachines/menu.py @@ -189,7 +189,7 @@ class Menu: for i, cls in enumerate(scenes): self._widgets += [DirectButton( text=cls.name(), pos=(left + dx * i, 1, .1), command=self.start, - extraArgs=[cls], + extraArgs=[cls], text_wordwrap=4, frameTexture='assets/images/scenes/%s.png' % cls.__name__, **cmn)] self._widgets += [DirectButton( diff --git a/pmachines/scenes/scene_domino_box.py b/pmachines/scenes/scene_domino_box.py new file mode 100644 index 0000000..91921c2 --- /dev/null +++ b/pmachines/scenes/scene_domino_box.py @@ -0,0 +1,45 @@ +from pmachines.scene import Scene +from pmachines.items.box import Box +from pmachines.items.shelf import Shelf +from pmachines.items.domino import Domino, TargetDomino +from pmachines.items.basketball import Basketball +from pmachines.items.teetertooter import TeeterTooter + + +class SceneDominoBox(Scene): + + sorting = 2 + + @staticmethod + def name(): + return _('Domino and box') + + def _set_items(self): + self.items = [] + self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=5, count=2)] + #self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, .21))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.67, 0, .21))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, -1.45))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.67, 0, -1.45))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(3.78, 0, -1.45))] + #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, -.94), r=37, tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, -.89), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, -.89), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, -.89), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, -.89), tgt_degrees=88)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, .73), r=37, tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, .78), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, .78), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, .78), tgt_degrees=60)] + self.items += [TargetDomino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, .78), tgt_degrees=88)] + #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)] + #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)] + + def _instr_txt(self): + txt = _('Scene: ') + self.name() + '\n\n' + txt += _('Goal: at least one domino piece per row must be up\n\n') + txt += _('keep \5mouse_l\5 pressed to drag an item\n\n' + 'keep \5mouse_r\5 pressed to rotate an item') + return txt diff --git a/prj.org b/prj.org index a495bc5..0397aaa 100644 --- a/prj.org +++ b/prj.org @@ -1,6 +1,6 @@ * issues * todo -** level domino + box +** level domino + box: end condition ** level basketball ** level domino + box + basketball ** level teetertooter -- 2.30.2