ya2 · news · projects · code · about

domino+box: end condition
[pmachines.git] / pmachines / scenes / scene_domino_box.py
CommitLineData
3211f3f3
FC
1from pmachines.scene import Scene
2from pmachines.items.box import Box
3from pmachines.items.shelf import Shelf
0e86689f 4from pmachines.items.domino import Domino, UpStrategy, DownStrategy
3211f3f3
FC
5from pmachines.items.basketball import Basketball
6from pmachines.items.teetertooter import TeeterTooter
7
8
9class SceneDominoBox(Scene):
10
11 sorting = 2
12
13 @staticmethod
14 def name():
15 return _('Domino and box')
16
17 def _set_items(self):
18 self.items = []
19 self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=5, count=2)]
20 #self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
21 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, .21))]
22 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.67, 0, .21))]
23 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, -1.45))]
24 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))]
25 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))]
26 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
0e86689f
FC
27 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, -.94), r=37)]
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=(-.06, 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=(0.91, 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=(1.73, 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=(2.57, 0, -.89))]
36 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
37 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, .73), r=37)]
38 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
39 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, .78))]
40 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
41 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, .78))]
42 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
43 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, .78))]
44 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
45 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, .78))]
46 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
3211f3f3
FC
47 #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
48 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
49
50 def _instr_txt(self):
51 txt = _('Scene: ') + self.name() + '\n\n'
0e86689f 52 txt += _('Goal: only the last piece of each row must be up\n\n')
3211f3f3
FC
53 txt += _('keep \5mouse_l\5 pressed to drag an item\n\n'
54 'keep \5mouse_r\5 pressed to rotate an item')
55 return txt
0e86689f
FC
56
57 def _end_condition(self):
58 return all(itm.strategy.end_condition() for itm in self.items) and not self._paused