ya2 · news · projects · code · about

changed do_physics
[pmachines.git] / pmachines / scenes / scene_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 SceneBasketBall(Scene):
10
11 sorting = 3
12
13 @staticmethod
14 def name():
15 return _('Basket ball')
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 += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=1)]
22 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, .21))]
23 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(1.67, 0, .21))]
24 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-.56, 0, -1.45))]
25 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))]
26 self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-4.45, 0, -3.18), r=27, restitution=1)]
27 #self.items += [Shelf(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=0, pos=(-5.45, 0, -3.18), restitution=1)]
28 #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))]
29 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=9)]
30 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 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=(-.06, 0, -.89))]
33 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
34 self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, -.89))]
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=(1.73, 0, -.89))]
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=(2.57, 0, -.89))]
39 self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 30))
40 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.61, 0, .73), r=37)]
41 #self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
42 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(-.06, 0, .78))]
43 #self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
44 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(0.91, 0, .78))]
45 #self.items[-1].set_strategy(DownStrategy(self.items[-1]._np, 35))
46 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(1.73, 0, .78))]
47 #self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
48 #self.items += [Domino(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, pos=(2.57, 0, .78))]
49 #self.items[-1].set_strategy(UpStrategy(self.items[-1]._np, 30))
50 #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
51 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
52
53 def _instr_txt(self):
54 txt = _('Scene: ') + self.name() + '\n\n'
55 txt += _('Goal: you must hit every domino piece\n\n')
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
59
60 def _win_condition(self):
61 return all(itm.strategy.win_condition() for itm in self.items) and not self._paused