@@ -215,27 +215,45 @@ class BreakoutPhysics {
215
215
216
216
createBoardPhysics ( ) {
217
217
{
218
- const wall = this . world . createBody ( { x : + 9 , y : - 0.5 } ) ;
218
+ const wall = this . world . createBody ( {
219
+ type : "static" ,
220
+ position : { x : + 9 , y : - 0.5 } ,
221
+ } ) ;
219
222
wall . createFixture ( new EdgeShape ( { x : 0 , y : - 12.5 } , { x : 0 , y : + 11.5 } ) , wallFix ) ;
220
223
}
221
224
{
222
- const wall = this . world . createBody ( { x : - 9 , y : - 0.5 } ) ;
225
+ const wall = this . world . createBody ( {
226
+ type : "static" ,
227
+ position : { x : - 9 , y : - 0.5 } ,
228
+ } ) ;
223
229
wall . createFixture ( new EdgeShape ( { x : 0 , y : - 12.5 } , { x : 0 , y : + 11.5 } ) , wallFix ) ;
224
230
}
225
231
{
226
- const wall = this . world . createBody ( { x : 0 , y : + 12 } ) ;
232
+ const wall = this . world . createBody ( {
233
+ type : "static" ,
234
+ position : { x : 0 , y : + 12 } ,
235
+ } ) ;
227
236
wall . createFixture ( new EdgeShape ( { x : - 8 , y : 0 } , { x : + 8 , y : 0 } ) , wallFix ) ;
228
237
}
229
238
{
230
- const wall = this . world . createBody ( { x : 9 , y : 12 } ) ;
239
+ const wall = this . world . createBody ( {
240
+ type : "static" ,
241
+ position : { x : 9 , y : 12 } ,
242
+ } ) ;
231
243
wall . createFixture ( new EdgeShape ( { x : - 1 , y : 0 } , { x : 0 , y : - 1 } ) , wallFix ) ;
232
244
}
233
245
{
234
- const wall = this . world . createBody ( { x : - 9 , y : 12 } ) ;
246
+ const wall = this . world . createBody ( {
247
+ type : "static" ,
248
+ position : { x : - 9 , y : 12 } ,
249
+ } ) ;
235
250
wall . createFixture ( new EdgeShape ( { x : 1 , y : 0 } , { x : 0 , y : - 1 } ) , wallFix ) ;
236
251
}
237
252
{
238
- const wall = this . world . createBody ( { x : 0 , y : - 13 } ) ;
253
+ const wall = this . world . createBody ( {
254
+ type : "static" ,
255
+ position : { x : 0 , y : - 13 } ,
256
+ } ) ;
239
257
wall . createFixture ( new EdgeShape ( { x : - 9 , y : 0 } , { x : + 9 , y : 0 } ) , wallFix ) ;
240
258
241
259
wall . setUserData ( new WallData ( ) ) ;
@@ -273,7 +291,8 @@ class BreakoutPhysics {
273
291
}
274
292
275
293
addBallPhysics ( data : BallData ) {
276
- const body = this . world . createDynamicBody ( {
294
+ const body = this . world . createBody ( {
295
+ type : "dynamic" ,
277
296
bullet : true ,
278
297
angle : Math . random ( ) * Math . PI * 2 ,
279
298
} ) ;
@@ -301,7 +320,10 @@ class BreakoutPhysics {
301
320
addBrickPhysics ( data : BrickData ) {
302
321
const shape = data . subtype == "small" ? smallBrickShape : normalBrickShape ;
303
322
const pos = { x : ( data . i - 3 ) * 2 , y : 9 - data . j * 2 } ;
304
- const body = this . world . createBody ( pos ) ;
323
+ const body = this . world . createBody ( {
324
+ type : "static" ,
325
+ position : pos ,
326
+ } ) ;
305
327
body . createFixture ( shape , brickFix ) ;
306
328
307
329
body . setUserData ( data ) ;
@@ -321,7 +343,9 @@ class BreakoutPhysics {
321
343
}
322
344
323
345
addDropPhysics ( drop : DropData ) {
324
- const body = this . world . createDynamicBody ( ) ;
346
+ const body = this . world . createBody ( {
347
+ type : "dynamic" ,
348
+ } ) ;
325
349
if ( drop . subtype == "+" ) {
326
350
body . createFixture ( new BoxShape ( 0.08 , 0.32 ) , dropFix ) ;
327
351
body . createFixture ( new BoxShape ( 0.32 , 0.08 ) , dropFix ) ;
0 commit comments