1 from pmachines
.scene
import Scene
2 from pmachines
.items
.shelf
import Shelf
3 from pmachines
.items
.domino
import Domino
, DownStrategy
4 from pmachines
.items
.basketball
import Basketball
7 class SceneBasketBall(Scene
):
9 filename
= 'assets/scenes/basketball.json'
13 return _('Basket ball')
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
+= [Basketball(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, count
=1)]
19 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-.56, 0, .21))]
20 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(1.67, 0, .21))]
21 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-.56, 0, -1.45))]
22 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))]
23 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)]
24 #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)]
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)]
27 self
.items
+= [Domino(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, pos
=(-.61, 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
=(-.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(DownStrategy(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))
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)]
50 # def _define_test_items(self):
51 # self._pos_mgr.register('drag_start_0', (55, 50))
52 # self._set_test_item('drag_stop_0', (-.42, 1.03))
53 # self._set_test_item('drag_stop_1', (-4.19, 4.66))
56 txt
= _('Scene: ') + self
.name() + '\n\n'
57 txt
+= _('Goal: you must hit every domino piece\n\n')
58 txt
+= _('keep \5mouse_l\5 pressed to drag an item\n\n'
59 'keep \5mouse_r\5 pressed to rotate an item')
62 def _win_condition(self
):
63 return all(itm
.strategy
.win_condition() for itm
in self
.items
) and not self
._paused