-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_clear_static_shapes2.py
More file actions
17 lines (17 loc) · 956 Bytes
/
Copy pathtest_clear_static_shapes2.py
File metadata and controls
17 lines (17 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import importlib.util, pymunk
mod_path = r'c:\Users\RIC0016\OneDrive - Templestowe College\Desktop\Coding\Python\Rohan_Python_Sims\Jelly Pytruck.py'
spec = importlib.util.spec_from_file_location('mod', mod_path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
space = pymunk.Space(); space.gravity = mod.GRAVITY
mod.load_level(space,1)
print('before clear: static shapes:', len(list(space.static_body.shapes)))
for i,s in enumerate(list(space.static_body.shapes)):
print(i, type(s).__name__, 'in space.shapes?', s in list(space.shapes))
truck = mod.Truck(space, pymunk.Vec2d(150,250))
mod.clear_level(space, truck)
print('after clear: static shapes:', len(list(space.static_body.shapes)))
for i,s in enumerate(list(space.static_body.shapes)):
print(i, type(s).__name__, 'in space.shapes?', s in list(space.shapes))
print('space.shapes total:', len(list(space.shapes)))
print('space.bodies total:', len(list(space.bodies)))