@@ -26,9 +26,22 @@ def test_physics_engine(window):
26
26
sprite .center_y = 32
27
27
wall_list .append (sprite )
28
28
29
+ platform_list = arcade .SpriteList [arcade .Sprite ]()
30
+ platform = arcade .Sprite (
31
+ ":resources:images/tiles/boxCrate_double.png" ,
32
+ scale = CHARACTER_SCALING ,
33
+ center_x = 64 ,
34
+ center_y = 256 ,
35
+ )
36
+ platform .boundary_left = 0 # 0 in particular was problematic, see #2658
37
+ platform .boundary_right = 128
38
+ platform .change_x = 8
39
+ platform_list .append (platform )
40
+
29
41
physics_engine = arcade .PhysicsEnginePlatformer (
30
42
character_sprite ,
31
- wall_list ,
43
+ walls = wall_list ,
44
+ platforms = platform_list ,
32
45
gravity_constant = GRAVITY ,
33
46
)
34
47
@@ -48,10 +61,23 @@ def update(td):
48
61
assert physics_engine .can_jump () is True
49
62
character_sprite .change_y = 15
50
63
physics_engine .increment_jump_counter ()
51
- window .test ()
64
+
65
+ window .test (frames = 7 )
66
+
52
67
assert physics_engine .can_jump () is True
68
+ assert platform .center_x == 80 # it bounced against the boundary_right
69
+ assert platform .change_x == - 8
53
70
character_sprite .change_y = 15
54
71
physics_engine .increment_jump_counter ()
55
- window .test ()
72
+
73
+ window .test (frames = 6 )
74
+
56
75
assert physics_engine .can_jump () is False
76
+ assert platform .center_x == 32 # right at the boundary
77
+ assert platform .change_x == - 8 # still going left
57
78
physics_engine .disable_multi_jump ()
79
+
80
+ window .test (frames = 3 )
81
+
82
+ assert platform .center_x == 32 + 24 # it bounced against the boundary_left
83
+ assert platform .change_x == + 8
0 commit comments