eeff1b448292768fcd6ef59b025a5d60340609cb
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
6 from pmachines
.items
.teetertooter
import TeeterTooter
9 class SceneTeeterDominoBoxBasketball(Scene
):
11 filename
= 'assets/scenes/domino_box_basketball.json'
15 return _('Teeter tooter, domino, box and basket ball')
18 self
.items
+= [Box(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=3, count
=2, friction
=1)]
19 self
.items
+= [Basketball(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, pos
=(.98, 1, 1.02))]
20 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-6.24, 0, -1.45))]
21 self
.items
+= [TeeterTooter(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-6.24, 0, -1.20))]
22 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=1, r
=24.60, friction
=1, pos
=(-6.15, 0, -.93))]
23 self
.items
+= [Box(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=.3, friction
=1, model_scale
=.5, pos
=(-5.38, 0, -.93), r
=24.60)]
24 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(5.37, 0, -.78))]
25 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(7.48, 0, -.78))]
26 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(4.74, 0, -1.95))]
27 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(6.88, 0, -1.95))]
28 self
.items
+= [Domino(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=1, pos
=(4.83, 0, -1.39))]
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
, mass
=1, pos
=(5.67, 0, -1.39))]
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
, mass
=1, pos
=(6.59, 0, -1.39))]
33 self
.items
[-1].set_strategy(DownStrategy(self
.items
[-1]._np
, 35))
34 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(.53, 0, -1.95), restitution
=.95)]
35 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(2.63, 0, -1.95), restitution
=.95)]
36 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-3.65, 0, 1.05), r
=28, friction
=0)]
37 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-1.27, 0, 1.72), restitution
=.95)]
38 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(.88, 0, 1.72), restitution
=.95)]
39 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(-1.67, 0, .55), restitution
=.95)]
40 self
.items
+= [Shelf(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=0, pos
=(.52, 0, .55), restitution
=.95)]
41 self
.items
+= [Domino(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=.5, pos
=(-1.73, 0, 1.11))]
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
, mass
=.5, pos
=(-.97, 0, 1.11))]
44 self
.items
[-1].set_strategy(DownStrategy(self
.items
[-1]._np
, 35))
45 self
.items
+= [Domino(self
._world
, self
._mouse
_plane
_node
, self
.cb_inst
, self
.current_bottom
, self
.repos
, mass
=.5, pos
=(-.1, 0, 1.11))]
46 self
.items
[-1].set_strategy(DownStrategy(self
.items
[-1]._np
, 35))
48 def _define_test_items(self
):
49 self
._pos
_mgr
.register('drag_start_0', (60, 60))
50 self
._set
_test
_item
('drag_stop_0', (-7.33, 4.24))
51 self
._set
_test
_item
('drag_stop_1', (-7.12, 4.24))
52 self
._set
_test
_item
('drag_start_1', (-6.77, 4.66))
53 self
._set
_test
_item
('drag_stop_2', (-6.77, 4.24))
56 txt
= _('Scene: ') + self
.name() + '\n\n'
57 txt
+= _('Goal: every domino piece must be hit\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