ya2 · news · projects · code · about

b53626db5efba45579d593567bebe5cd1f2efb40
[pmachines.git] / pmachines / scenes / scene_domino_box_basketball.py
1 from pmachines.scene import Scene
2 from pmachines.items.box import Box
3 from pmachines.items.shelf import Shelf
4 from pmachines.items.domino import Domino, UpStrategy, DownStrategy
5 from pmachines.items.basketball import Basketball
6 from pmachines.items.teetertooter import TeeterTooter
7
8
9 class SceneDominoBoxBasketball(Scene):
10
11 @staticmethod
12 def name():
13 return _('Domino, box and basket ball')
14
15 def _set_items(self):
16 self.items = []
17 self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=1, mass=5)]
18 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=1)]
19 self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.3, 1, 2.5))]
20 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, -1.45))]
21 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))]
22 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))]
23 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.48, 0, .38), r=-90)]
24 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(2.62, 0, .05))]
25 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(4.88, 0, .05))]
26 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
27 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.68, 0, -.89))]
28 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
29 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.35, 0, -.89))]
30 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
31 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(3.08, 0, -.89))]
32 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
33 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(3.78, 0, -.89))]
34 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
35 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(4.53, 0, -.89))]
36 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
37 #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
38 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
39
40 def _instr_txt(self):
41 txt = _('Scene: ') + self.name() + '\n\n'
42 txt += _('Goal: every domino piece must be hit\n\n')
43 txt += _('keep \5mouse_l\5 pressed to drag an item\n\n'
44 'keep \5mouse_r\5 pressed to rotate an item')
45 return txt
46
47 def _win_condition(self):
48 return all(itm.strategy.win_condition() for itm in self.items) and not self._paused