(x, y, width, height, color)
| 387 | window.game.scene.addChild(rightWall); |
| 388 | } |
| 389 | function createGameObjectAddGraphicsRect(x, y, width, height, color) { |
| 390 | const gameObject = new GameObject('gameObject', { |
| 391 | position: { |
| 392 | x, |
| 393 | y, |
| 394 | }, |
| 395 | size: { |
| 396 | width, |
| 397 | height, |
| 398 | }, |
| 399 | origin: { |
| 400 | x: 0.5, |
| 401 | y: 0.5, |
| 402 | }, |
| 403 | }); |
| 404 | const { graphics } = gameObject.addComponent(new Graphics()); |
| 405 | graphics.rect(0, 0, gameObject.transform.size.width, gameObject.transform.size.height).fill(color); |
| 406 | gameObject.addComponent( |
| 407 | new Physics({ |
| 408 | type: PhysicsType.RECTANGLE, |
| 409 | bodyOptions: { |
| 410 | isStatic: true, |
| 411 | }, |
| 412 | }), |
| 413 | ); |
| 414 | return gameObject; |
| 415 | } |
| 416 | |
| 417 | function buildFruit(name, x, y, radius, type) { |
| 418 | const gameObject = new GameObject(name, { |
no test coverage detected