7d2f9dd99c2765c7493023bf7abe275747271f98
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
.teetertooter
import TeeterTooter
8 class SceneTeeterTooter(Scene
):
10 filename
= 'assets/scenes/teeter_tooter.json'
14 return _('Teeter tooter')
17 self
.items
+= [Box(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=3, count
=1, friction
=1)]
18 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, mass=5, count=2)]
19 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-2.76, 0, -1.45))]
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
=(2.27, 0, -.28))]
22 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(4.38, 0, -.28))]
23 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))]
24 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))]
25 self
.items
+= [TeeterTooter(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-2.74, 0, -1.20))]
26 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=1, r
=-25.30, friction
=1, pos
=(-2.78, 0, -.93))]
27 self
.items
+= [Box(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=.2, friction
=1, model_scale
=.5, pos
=(-3.61, 0, -.99), r
=-25.30)]
28 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-.25, 0, -.57), r
=52)]
29 self
.items
+= [Domino(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, pos
=(1.73, 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
=(2.57, 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.50, 0, -.89))]
34 self
.items
[-1].set_strategy(DownStrategy(self
.items
[-1]._np
, 35))
35 #self.items += [Basketball(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
36 #self.items += [TeeterTooter(self._world, self._mouse_plane_node, self.cb_inst, self.current_bottom, self.repos, count=3)]
38 def _define_test_items(self
):
39 self
._pos
_mgr
.register('drag_start_0', (60, 60))
40 self
._set
_test
_item
('drag_stop_0', (-2.65, 1.18))
41 self
._set
_test
_item
('drag_stop_1', (-2.65, 3.27))
42 self
._set
_test
_item
('drag_start_1', (-2.3, 3.75))
43 self
._set
_test
_item
('drag_stop_2', (-2.5, 3.66))
46 txt
= _('Scene: ') + self
.name() + '\n\n'
47 txt
+= _('Goal: you must hit every domino piece\n\n')
48 txt
+= _('keep \5mouse_l\5 pressed to drag an item\n\n'
49 'keep \5mouse_r\5 pressed to rotate an item')
52 def _win_condition(self
):
53 return all(itm
.strategy
.win_condition() for itm
in self
.items
) and not self
._paused