c08ac3a8f9b88de1b9a7ddd1980716530d3a9fba
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
, DownStrategy
5 from pmachines
.items
.basketball
import Basketball
8 class SceneDominoBoxBasketball(Scene
):
10 filename
= 'assets/scenes/domino_box_basketball.json'
14 return _('Domino, box and basket ball')
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)]
40 # def _define_test_items(self):
41 # self._pos_mgr.register('drag_start_0', (65, 60))
42 # self._pos_mgr.register('drag_start_1', (30, 60))
43 # self._set_test_item('drag_stop_0', (-1.4, -.78))
44 # self._set_test_item('drag_stop_1', (-1.26, .2))
45 # self._set_test_item('drag_stop_2', (-.28, -.78))
46 # self._set_test_item('drag_start_2', (-.28, -.57))
47 # self._set_test_item('drag_stop_3', (-.77, -.57))
48 # self._set_test_item('drag_start_3', (-.28, -.85))
49 # self._set_test_item('drag_stop_4', (-.42, -.85))
52 txt
= _('Scene: ') + self
.name() + '\n\n'
53 txt
+= _('Goal: every domino piece must be hit\n\n')
54 txt
+= _('keep \5mouse_l\5 pressed to drag an item\n\n'
55 'keep \5mouse_r\5 pressed to rotate an item')
58 def _win_condition(self
):
59 return all(itm
.strategy
.win_condition() for itm
in self
.items
) and not self
._paused