ya2 · news · projects · code · about

abstract test positions in world units
[pmachines.git] / pmachines / scenes / scene_domino_box.py
CommitLineData
4586cbf6
FC
1from pmachines.scene import Scene
2from pmachines.items.box import Box
3from pmachines.items.shelf import Shelf
4from pmachines.items.domino import Domino, UpStrategy, DownStrategy
5from pmachines.items.basketball import Basketball
6from pmachines.items.teetertooter import TeeterTooter
3211f3f3
FC
7
8
9class SceneDominoBox(Scene):
10
3211f3f3
FC
11 @staticmethod
12 def name():
13 return _('Domino and box')
14
15 def _set_items(self):
3211f3f3
FC
16 self.items += [Box(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=5, count=2)]
17 #self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
18 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, .21))]
19 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.67, 0, .21))]
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 += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
0e86689f
FC
24 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, -.94), r=37)]
25 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
26 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, -.89))]
27 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
28 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, -.89))]
29 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
30 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, -.89))]
31 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
32 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, -.89))]
33 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
34 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, .73), r=37)]
35 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
36 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, .78))]
37 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
38 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, .78))]
39 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
40 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, .78))]
41 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
42 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, .78))]
43 self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
3211f3f3
FC
44 #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
45 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
46
067a36db
FC
47 def _define_test_items(self):
48 self._pos_mgr.register('drag_start_0', (65, 60))
49 self._set_test_item('drag_stop_0', (3.21, -.78))
50 self._set_test_item('drag_stop_1', (3.21, .33))
51 self._set_test_item('drag_stop_2', (2.16, 1.87))
52
3211f3f3
FC
53 def _instr_txt(self):
54 txt = _('Scene: ') + self.name() + '\n\n'
0e86689f 55 txt += _('Goal: only the last piece of each row must be up\n\n')
3211f3f3
FC
56 txt += _('keep \5mouse_l\5 pressed to drag an item\n\n'
57 'keep \5mouse_r\5 pressed to rotate an item')
58 return txt
0e86689f 59
0a0994e4
FC
60 def _win_condition(self):
61 return all(itm.strategy.win_condition() for itm in self.items) and not self._paused