From: Flavio Calva Date: Tue, 8 Mar 2022 18:24:12 +0000 (+0100) Subject: level teeter tooter, domino, box, basketball X-Git-Url: http://git.ya2.it/?p=pmachines.git;a=commitdiff_plain;h=a5fddddc0a72513fd2e8961658068476e8fbde04 level teeter tooter, domino, box, basketball --- diff --git a/pmachines/menu.py b/pmachines/menu.py index 9bd5c39..5bd1667 100644 --- a/pmachines/menu.py +++ b/pmachines/menu.py @@ -186,12 +186,13 @@ class Menu: 'frameSize': (-2.4, 2.4, -2.4, 2.4), 'frameColor': (1, 1, 1, .8), 'text_scale': .64} - left = - (dx := .8) * (min(3, len(scenes)) - 1) / 2 + left = - (dx := .8) * (min(4, len(scenes)) - 1) / 2 for i, cls in enumerate(scenes): - top = .1 if len(scenes) < 4 else .6 - row = 0 if i < 3 else 1 + print(i, cls) + top = .1 if len(scenes) < 5 else .6 + row = 0 if i < 4 else 1 self._widgets += [DirectButton( - text=cls.name(), pos=(left + dx * (i % 3), 1, top - dx * row), + text=cls.name(), pos=(left + dx * (i % 4), 1, top - dx * row), command=self.start, extraArgs=[cls], text_wordwrap=6, frameTexture='assets/images/scenes/%s.png' % cls.__name__, **cmn)] diff --git a/pmachines/scenes/scene_teeter_domino_box_basketball.py b/pmachines/scenes/scene_teeter_domino_box_basketball.py new file mode 100644 index 0000000..08dff9e --- /dev/null +++ b/pmachines/scenes/scene_teeter_domino_box_basketball.py @@ -0,0 +1,57 @@ +from pmachines.scene import Scene +from pmachines.items.box import Box +from pmachines.items.shelf import Shelf +from pmachines.items.domino import Domino, UpStrategy, DownStrategy +from pmachines.items.basketball import Basketball +from pmachines.items.teetertooter import TeeterTooter + + +class SceneTeeterDominoBoxBasketball(Scene): + + sorting = 6 + + @staticmethod + def name(): + return _('Teeter tooter, domino, box and basket ball') + + def _set_items(self): + self.items = [] + self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=3, count=2, friction=1)] + self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(.98, 1, 1.02))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-6.24, 0, -1.45))] + self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-6.24, 0, -1.20))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=1, r=24.60, friction=1, pos=(-6.15, 0, -.93))] + self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=.3, friction=1, model_scale=.5, pos=(-5.38, 0, -.93), r=24.60)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(5.37, 0, -.78))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(7.48, 0, -.78))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(4.74, 0, -1.95))] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(6.88, 0, -1.95))] + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=1, pos=(4.83, 0, -1.39))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=1, pos=(5.67, 0, -1.39))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=1, pos=(6.59, 0, -1.39))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(.53, 0, -1.95), restitution=.95)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(2.63, 0, -1.95), restitution=.95)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-3.65, 0, 1.05), r=28, friction=0)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-1.27, 0, 1.72), restitution=.95)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(.88, 0, 1.72), restitution=.95)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-1.67, 0, .55), restitution=.95)] + self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(.52, 0, .55), restitution=.95)] + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=.5, pos=(-1.73, 0, 1.11))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=.5, pos=(-.97, 0, 1.11))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=.5, pos=(-.1, 0, 1.11))] + self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35)) + + def _instr_txt(self): + txt = _('Scene: ') + self.name() + '\n\n' + txt += _('Goal: every domino piece must be hit\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 + + def _win_condition(self): + return all(itm.strategy.win_condition() for itm in self.items) and not self._paused diff --git a/prj.org b/prj.org index b11e6ed..40cd9d2 100644 --- a/prj.org +++ b/prj.org @@ -1,6 +1,5 @@ * issues * todo -** level domino + box + basketball + teetertooter ** optimize images creation (python setup.py images) ** use dds files in place of png/jpg ** use bam files @@ -10,11 +9,11 @@ ** do intro video with moviepy ** android build ** intro animation (from target item to start position) -** buttons of the scenes with played indications -*** each scene has a last-modification -*** when you win save the id + last-modification -*** put a check if id is saved and last-modifications are equal -** magnet, road cone, bucket +** buttons of the scenes enabled sequentially +*** each scene has a version +*** when you win save the id + version +*** put an "update" if id is saved and versions are different +** teeter-tooter with constraints (real teeter tooter), magnet, road cone, bucket * waiting ** itch.io's client works with wine: functional tests for windows-itch.io * maybe/someday