diff --git a/Game.vue b/Game.vue index 9ca393e..a612ac3 100644 --- a/Game.vue +++ b/Game.vue @@ -5,7 +5,8 @@ import ballMove from "./games/game-ballmove/game"; import flappyBird from "./games/game-flipbird/game"; import game2048 from "./games/game2048/game"; -const games = { ballMove, flappyBird, game2048 }; +import rect from "./games/game-rect/game"; +const games = { ballMove, flappyBird, game2048, rect }; const STATE_RUNNING = 0; const STATE_LOSE = 1; const STATE_WIN = 2; diff --git a/games/game-flipbird/scenes/flipbird/GameOver.js b/games/game-flipbird/scenes/flipbird/GameOver.js deleted file mode 100644 index 550aee7..0000000 --- a/games/game-flipbird/scenes/flipbird/GameOver.js +++ /dev/null @@ -1,51 +0,0 @@ -import { Scene } from "phaser"; -import bg from "@/game/game/assets/flipbird/bg.png"; - -import gameoverbg from "@/game/game/assets/flipbird/gameoverbg.png"; -import gameover from "@/game/game/assets/flipbird/gameover.png"; - -export default class gameOverScene extends Scene { - constructor() { - super({ key: "flipBirdGameOver" }); - this.score = ""; - this.topScore = ""; - } - - init(data) { - //方法1. 引入sceneA 在初始化的时候就可以获得场景Scene传递的值; - this.score = data.score; - this.topScore = data.topScore; - } - preload() { - this.load.image("bg", bg); - this.load.image("gameoverbg", gameoverbg); - this.load.image("gameover", gameover); - } - - create() { - this.bg = this.add.image(0, 0, "bg"); - this.bg.setScale(3.1); - this.gameoverbg = this.add.image( - this.game.config.width / 2, - this.game.config.height / 2, - "gameoverbg" - ); - this.gameover = this.add.image( - this.game.config.width / 2, - this.game.config.height / 2 - 80, - "gameover" - ); - this.scoreText = this.add.text( - this.game.config.width / 2, - this.game.config.height / 2 + 80, - "", - { fontSize: "55px", fill: "black", fontWeight: 800 } - ); - this.scoreText.setOrigin(0.5); - this.scoreText.text = "Score: " + this.score + "\nBest: " + this.topScore; - this.bg.setInteractive(); - this.bg.on("pointerdown", () => { - this.scene.start("flipbird"); - }) - } -} diff --git a/games/game-flipbird/scenes/flipbird/sprites.json b/games/game-flipbird/scenes/flipbird/sprites.json deleted file mode 100644 index 430f375..0000000 --- a/games/game-flipbird/scenes/flipbird/sprites.json +++ /dev/null @@ -1,736 +0,0 @@ -{ - "generator_info": "Shape definitions generated with PhysicsEditor. Visit https://www.codeandweb.com/physicseditor", - "pipe1": { - "type": "fromPhysicsEditor", - "label": "pipe1", - "isStatic": false, - "density": 0.1, - "restitution": 0, - "friction": 0.1, - "frictionAir": 0.01, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":186, "y":1583 }, { "x":186, "y":1593 }, { "x":192, "y":1583 } ], - [ { "x":410, "y":1993 }, { "x":410, "y":1991 }, { "x":408, "y":1994 } ], - [ { "x":291, "y":1602 }, { "x":288, "y":1602 }, { "x":293, "y":1604 } ], - [ { "x":47, "y":1693 }, { "x":46, "y":1697 }, { "x":50, "y":1691 } ], - [ { "x":206, "y":1484 }, { "x":205, "y":1488 }, { "x":209, "y":1482 } ], - [ { "x":180, "y":1566 }, { "x":185, "y":1570 }, { "x":192, "y":1570 }, { "x":225, "y":1552 }, { "x":184, "y":1552 }, { "x":180, "y":1556 } ], - [ { "x":248, "y":1457 }, { "x":248, "y":1455 }, { "x":245, "y":1459 } ], - [ { "x":225, "y":1486 }, { "x":225, "y":1484 }, { "x":222, "y":1488 } ], - [ { "x":57, "y":1679 }, { "x":57, "y":1681 }, { "x":60, "y":1677 } ], - [ { "x":228, "y":1456 }, { "x":228, "y":1458 }, { "x":233, "y":1474 }, { "x":231, "y":1454 } ], - [ { "x":231, "y":1452 }, { "x":231, "y":1454 }, { "x":233, "y":1474 }, { "x":234, "y":1450 } ], - [ { "x":234, "y":1448 }, { "x":234, "y":1450 }, { "x":237, "y":1446 } ], - [ { "x":291, "y":1578 }, { "x":291, "y":1566 }, { "x":284, "y":1555 }, { "x":266, "y":1547 }, { "x":233, "y":1539 }, { "x":266, "y":1595 }, { "x":274, "y":1593 }, { "x":284, "y":1588 } ], - [ { "x":234, "y":1314 }, { "x":232, "y":1313 }, { "x":235, "y":1318 } ], - [ { "x":109, "y":2067 }, { "x":113, "y":2068 }, { "x":305, "y":2082 }, { "x":407, "y":1706 }, { "x":405, "y":1705 }, { "x":18, "y":1754 }, { "x":16, "y":1756 }, { "x":108, "y":2065 } ], - [ { "x":123, "y":1618 }, { "x":122, "y":1620 }, { "x":127, "y":1617 } ], - [ { "x":192, "y":1570 }, { "x":192, "y":1583 }, { "x":225, "y":1552 } ], - [ { "x":245, "y":1461 }, { "x":245, "y":1459 }, { "x":241, "y":1464 } ], - [ { "x":233, "y":1476 }, { "x":233, "y":1474 }, { "x":229, "y":1479 } ], - [ { "x":229, "y":1481 }, { "x":229, "y":1479 }, { "x":225, "y":1484 } ], - [ { "x":60, "y":1675 }, { "x":60, "y":1677 }, { "x":64, "y":1672 } ], - [ { "x":104, "y":1631 }, { "x":101, "y":1635 }, { "x":106, "y":1631 } ], - [ { "x":215, "y":1472 }, { "x":215, "y":1474 }, { "x":219, "y":1469 } ], - [ { "x":219, "y":1467 }, { "x":219, "y":1469 }, { "x":223, "y":1464 } ], - [ { "x":108, "y":1628 }, { "x":106, "y":1631 }, { "x":113, "y":1626 } ], - [ { "x":251, "y":1341 }, { "x":247, "y":1337 }, { "x":254, "y":1388 }, { "x":262, "y":1433 }, { "x":252, "y":1345 } ], - [ { "x":234, "y":1345 }, { "x":238, "y":1349 }, { "x":233, "y":1341 } ], - [ { "x":222, "y":1326 }, { "x":226, "y":1330 }, { "x":221, "y":1322 } ], - [ { "x":238, "y":1470 }, { "x":241, "y":1464 }, { "x":233, "y":1474 } ], - [ { "x":347, "y":1635 }, { "x":345, "y":1635 }, { "x":351, "y":1640 } ], - [ { "x":223, "y":1462 }, { "x":223, "y":1464 }, { "x":228, "y":1458 } ], - [ { "x":118, "y":1621 }, { "x":113, "y":1626 }, { "x":122, "y":1620 } ], - [ { "x":128, "y":1615 }, { "x":127, "y":1617 }, { "x":134, "y":1613 } ], - [ { "x":219, "y":1321 }, { "x":221, "y":1322 }, { "x":193, "y":1233 }, { "x":217, "y":1315 } ], - [ { "x":303, "y":2084 }, { "x":305, "y":2082 }, { "x":113, "y":2068 }, { "x":149, "y":2085 }, { "x":297, "y":2085 } ], - [ { "x":143, "y":2084 }, { "x":149, "y":2085 }, { "x":141, "y":2082 } ], - [ { "x":34, "y":1990 }, { "x":38, "y":1994 }, { "x":31, "y":1982 } ], - [ { "x":203, "y":1535 }, { "x":211, "y":1544 }, { "x":225, "y":1552 }, { "x":222, "y":1533 }, { "x":214, "y":1523 }, { "x":197, "y":1506 }, { "x":198, "y":1523 } ], - [ { "x":135, "y":1611 }, { "x":134, "y":1613 }, { "x":144, "y":1608 }, { "x":141, "y":1608 } ], - [ { "x":203, "y":1489 }, { "x":200, "y":1495 }, { "x":197, "y":1506 }, { "x":205, "y":1488 } ], - [ { "x":237, "y":1319 }, { "x":235, "y":1318 }, { "x":249, "y":1370 }, { "x":240, "y":1326 } ], - [ { "x":412, "y":1990 }, { "x":415, "y":1982 }, { "x":410, "y":1991 } ], - [ { "x":362, "y":2049 }, { "x":368, "y":2042 }, { "x":360, "y":2049 } ], - [ { "x":84, "y":2049 }, { "x":86, "y":2049 }, { "x":78, "y":2042 } ], - [ { "x":392, "y":1683 }, { "x":386, "y":1677 }, { "x":392, "y":1685 } ], - [ { "x":289, "y":2089 }, { "x":297, "y":2085 }, { "x":149, "y":2085 } ], - [ { "x":209, "y":1480 }, { "x":209, "y":1482 }, { "x":215, "y":1474 } ], - [ { "x":342, "y":1631 }, { "x":293, "y":1604 }, { "x":345, "y":1635 } ], - [ { "x":269, "y":1409 }, { "x":269, "y":1386 }, { "x":265, "y":1369 }, { "x":254, "y":1346 }, { "x":252, "y":1345 }, { "x":262, "y":1433 } ], - [ { "x":407, "y":1998 }, { "x":408, "y":1994 }, { "x":305, "y":2082 }, { "x":360, "y":2049 }, { "x":368, "y":2042 } ], - [ { "x":39, "y":1706 }, { "x":36, "y":1714 }, { "x":46, "y":1697 } ], - [ { "x":43, "y":2004 }, { "x":48, "y":2009 }, { "x":38, "y":1994 } ], - [ { "x":222, "y":1490 }, { "x":222, "y":1488 }, { "x":197, "y":1506 }, { "x":216, "y":1497 } ], - [ { "x":277, "y":1597 }, { "x":266, "y":1595 }, { "x":288, "y":1602 } ], - [ { "x":97, "y":2059 }, { "x":108, "y":2065 }, { "x":86, "y":2049 } ], - [ { "x":50, "y":1689 }, { "x":50, "y":1691 }, { "x":57, "y":1681 } ], - [ { "x":337, "y":2067 }, { "x":347, "y":2059 }, { "x":333, "y":2068 } ], - [ { "x":242, "y":1327 }, { "x":240, "y":1326 }, { "x":249, "y":1370 }, { "x":254, "y":1388 }, { "x":247, "y":1337 } ], - [ { "x":242, "y":1436 }, { "x":237, "y":1446 }, { "x":233, "y":1474 }, { "x":241, "y":1464 }, { "x":262, "y":1433 }, { "x":244, "y":1435 } ], - [ { "x":231, "y":1340 }, { "x":233, "y":1341 }, { "x":193, "y":1233 }, { "x":226, "y":1330 } ], - [ { "x":417, "y":1981 }, { "x":423, "y":1969 }, { "x":423, "y":1966 }, { "x":407, "y":1706 }, { "x":415, "y":1982 } ], - [ { "x":29, "y":1981 }, { "x":31, "y":1982 }, { "x":23, "y":1966 }, { "x":23, "y":1969 } ], - [ { "x":23, "y":1738 }, { "x":18, "y":1754 }, { "x":27, "y":1732 } ], - [ { "x":233, "y":1539 }, { "x":222, "y":1533 }, { "x":225, "y":1552 }, { "x":266, "y":1595 } ], - [ { "x":349, "y":2059 }, { "x":360, "y":2049 }, { "x":347, "y":2059 } ], - [ { "x":160, "y":1600 }, { "x":134, "y":1613 }, { "x":122, "y":1620 }, { "x":18, "y":1754 }, { "x":405, "y":1705 }, { "x":186, "y":1593 } ], - [ { "x":196, "y":1261 }, { "x":204, "y":1290 }, { "x":215, "y":1314 }, { "x":217, "y":1315 }, { "x":193, "y":1233 } ], - [ { "x":34, "y":1715 }, { "x":27, "y":1729 }, { "x":27, "y":1732 }, { "x":36, "y":1714 } ], - [ { "x":254, "y":1448 }, { "x":262, "y":1433 }, { "x":248, "y":1455 } ], - [ { "x":398, "y":2011 }, { "x":400, "y":2006 }, { "x":368, "y":2042 } ], - [ { "x":446, "y":1832 }, { "x":439, "y":1787 }, { "x":427, "y":1748 }, { "x":407, "y":1706 }, { "x":423, "y":1966 }, { "x":443, "y":1904 }, { "x":446, "y":1880 } ], - [ { "x":404, "y":1701 }, { "x":386, "y":1677 }, { "x":351, "y":1640 }, { "x":293, "y":1604 }, { "x":266, "y":1595 }, { "x":186, "y":1593 }, { "x":405, "y":1705 } ], - [ { "x":384, "y":2028 }, { "x":384, "y":2026 }, { "x":368, "y":2042 }, { "x":370, "y":2042 } ], - [ { "x":76, "y":2042 }, { "x":78, "y":2042 }, { "x":62, "y":2026 }, { "x":62, "y":2028 } ], - [ { "x":270, "y":2094 }, { "x":285, "y":2089 }, { "x":149, "y":2085 }, { "x":181, "y":2095 }, { "x":202, "y":2098 }, { "x":244, "y":2098 } ], - [ { "x":48, "y":2011 }, { "x":78, "y":2042 }, { "x":48, "y":2009 } ], - [ { "x":5, "y":1796 }, { "x":0, "y":1832 }, { "x":0, "y":1880 }, { "x":3, "y":1904 }, { "x":19, "y":1960 }, { "x":23, "y":1966 }, { "x":108, "y":2065 }, { "x":16, "y":1756 } ], - [ { "x":429, "y":1955 }, { "x":437, "y":1931 }, { "x":443, "y":1904 }, { "x":423, "y":1966 } ], - [ { "x":157, "y":2089 }, { "x":181, "y":2095 }, { "x":149, "y":2085 } ], - [ { "x":192, "y":1583 }, { "x":186, "y":1593 }, { "x":266, "y":1595 }, { "x":225, "y":1552 } ], - [ { "x":9, "y":1931 }, { "x":19, "y":1960 }, { "x":3, "y":1904 } ], - [ { "x":328, "y":1621 }, { "x":296, "y":1604 }, { "x":293, "y":1604 }, { "x":333, "y":1626 } ], - [ { "x":332, "y":2070 }, { "x":333, "y":2068 }, { "x":305, "y":2082 }, { "x":308, "y":2082 } ], - [ { "x":114, "y":2070 }, { "x":138, "y":2082 }, { "x":141, "y":2082 }, { "x":113, "y":2068 } ], - [ { "x":205, "y":1488 }, { "x":197, "y":1506 }, { "x":233, "y":1474 }, { "x":228, "y":1458 }, { "x":209, "y":1482 } ], - [ { "x":48, "y":2009 }, { "x":78, "y":2042 }, { "x":86, "y":2049 }, { "x":108, "y":2065 }, { "x":23, "y":1966 }, { "x":31, "y":1982 }, { "x":38, "y":1994 } ], - [ { "x":347, "y":2059 }, { "x":360, "y":2049 }, { "x":305, "y":2082 }, { "x":333, "y":2068 } ], - [ { "x":27, "y":1732 }, { "x":18, "y":1754 }, { "x":122, "y":1620 }, { "x":50, "y":1691 }, { "x":46, "y":1697 }, { "x":36, "y":1714 } ], - [ { "x":353, "y":1640 }, { "x":351, "y":1640 }, { "x":386, "y":1677 }, { "x":386, "y":1675 } ], - [ { "x":64, "y":1670 }, { "x":64, "y":1672 }, { "x":101, "y":1635 }, { "x":99, "y":1635 } ], - [ { "x":106, "y":1631 }, { "x":101, "y":1635 }, { "x":64, "y":1672 }, { "x":57, "y":1681 }, { "x":50, "y":1691 }, { "x":122, "y":1620 } ], - [ { "x":141, "y":2082 }, { "x":149, "y":2085 }, { "x":113, "y":2068 } ], - [ { "x":410, "y":1991 }, { "x":415, "y":1982 }, { "x":407, "y":1706 }, { "x":305, "y":2082 }, { "x":408, "y":1994 } ], - [ { "x":221, "y":1322 }, { "x":226, "y":1330 }, { "x":193, "y":1233 } ], - [ { "x":345, "y":1635 }, { "x":293, "y":1604 }, { "x":351, "y":1640 } ], - [ { "x":233, "y":1341 }, { "x":238, "y":1349 }, { "x":193, "y":1233 } ], - [ { "x":238, "y":1349 }, { "x":249, "y":1370 }, { "x":220, "y":1289 }, { "x":193, "y":1233 } ], - [ { "x":288, "y":1602 }, { "x":266, "y":1595 }, { "x":293, "y":1604 } ], - [ { "x":248, "y":1455 }, { "x":262, "y":1433 }, { "x":241, "y":1464 } ], - [ { "x":60, "y":1677 }, { "x":57, "y":1681 }, { "x":64, "y":1672 } ], - [ { "x":193, "y":0 }, { "x":193, "y":1233 }, { "x":208, "y":1234 }, { "x":208, "y":0 } ], - [ { "x":208, "y":1234 }, { "x":193, "y":1233 }, { "x":211, "y":1259 } ], - [ { "x":211, "y":1259 }, { "x":193, "y":1233 }, { "x":220, "y":1289 } ], - [ { "x":220, "y":1289 }, { "x":249, "y":1370 }, { "x":232, "y":1313 } ], - [ { "x":232, "y":1313 }, { "x":249, "y":1370 }, { "x":235, "y":1318 } ], - [ { "x":254, "y":1388 }, { "x":254, "y":1407 }, { "x":262, "y":1433 } ], - [ { "x":254, "y":1407 }, { "x":249, "y":1425 }, { "x":262, "y":1433 } ], - [ { "x":249, "y":1425 }, { "x":244, "y":1435 }, { "x":262, "y":1433 } ], - [ { "x":237, "y":1446 }, { "x":234, "y":1450 }, { "x":233, "y":1474 } ], - [ { "x":233, "y":1474 }, { "x":197, "y":1506 }, { "x":225, "y":1484 } ], - [ { "x":225, "y":1484 }, { "x":197, "y":1506 }, { "x":222, "y":1488 } ], - [ { "x":216, "y":1497 }, { "x":197, "y":1506 }, { "x":212, "y":1507 } ], - [ { "x":212, "y":1507 }, { "x":197, "y":1506 }, { "x":214, "y":1523 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1567 }, { "x":192, "y":1570 }, { "x":225, "y":1552 }, { "x":183, "y":1553 } ], - [ { "x":291, "y":1578 }, { "x":286, "y":1557 }, { "x":224, "y":1534 }, { "x":225, "y":1552 }, { "x":270, "y":1594 } ], - [ { "x":202, "y":1533 }, { "x":225, "y":1552 }, { "x":224, "y":1534 }, { "x":213, "y":1520 }, { "x":197, "y":1506 } ], - [ { "x":192, "y":1570 }, { "x":185, "y":1594 }, { "x":270, "y":1594 }, { "x":225, "y":1552 } ], - [ { "x":202, "y":2098 }, { "x":285, "y":2090 }, { "x":332, "y":2070 }, { "x":371, "y":2041 }, { "x":422, "y":1971 }, { "x":437, "y":1931 }, { "x":76, "y":2042 }, { "x":123, "y":2075 } ], - [ { "x":120, "y":1620 }, { "x":60, "y":1675 }, { "x":19, "y":1748 }, { "x":0, "y":1832 }, { "x":8, "y":1927 }, { "x":50, "y":2013 }, { "x":270, "y":1594 }, { "x":185, "y":1594 } ], - [ { "x":269, "y":1409 }, { "x":268, "y":1380 }, { "x":251, "y":1375 }, { "x":253, "y":1407 }, { "x":257, "y":1443 } ], - [ { "x":339, "y":1629 }, { "x":270, "y":1594 }, { "x":50, "y":2013 }, { "x":76, "y":2042 }, { "x":437, "y":1931 }, { "x":446, "y":1880 }, { "x":437, "y":1779 }, { "x":398, "y":1692 } ], - [ { "x":198, "y":1270 }, { "x":210, "y":1302 }, { "x":251, "y":1375 }, { "x":221, "y":1291 }, { "x":194, "y":1233 } ], - [ { "x":24, "y":1971 }, { "x":50, "y":2013 }, { "x":8, "y":1927 } ], - [ { "x":213, "y":1520 }, { "x":215, "y":1499 }, { "x":209, "y":1480 }, { "x":197, "y":1506 } ], - [ { "x":215, "y":1499 }, { "x":257, "y":1443 }, { "x":245, "y":1433 }, { "x":209, "y":1480 } ], - [ { "x":245, "y":1433 }, { "x":257, "y":1443 }, { "x":253, "y":1407 } ], - [ { "x":268, "y":1380 }, { "x":221, "y":1291 }, { "x":251, "y":1375 } ], - [ { "x":221, "y":1291 }, { "x":208, "y":1234 }, { "x":194, "y":1233 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1233 }, { "x":208, "y":1234 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1567 }, { "x":192, "y":1570 }, { "x":225, "y":1552 }, { "x":183, "y":1553 } ], - [ { "x":291, "y":1578 }, { "x":286, "y":1557 }, { "x":224, "y":1534 }, { "x":225, "y":1552 }, { "x":270, "y":1594 } ], - [ { "x":202, "y":1533 }, { "x":225, "y":1552 }, { "x":224, "y":1534 }, { "x":213, "y":1520 }, { "x":197, "y":1506 } ], - [ { "x":192, "y":1570 }, { "x":185, "y":1594 }, { "x":270, "y":1594 }, { "x":225, "y":1552 } ], - [ { "x":202, "y":2098 }, { "x":285, "y":2090 }, { "x":332, "y":2070 }, { "x":371, "y":2041 }, { "x":422, "y":1971 }, { "x":437, "y":1931 }, { "x":76, "y":2042 }, { "x":123, "y":2075 } ], - [ { "x":120, "y":1620 }, { "x":60, "y":1675 }, { "x":19, "y":1748 }, { "x":0, "y":1832 }, { "x":8, "y":1927 }, { "x":50, "y":2013 }, { "x":270, "y":1594 }, { "x":185, "y":1594 } ], - [ { "x":269, "y":1409 }, { "x":268, "y":1380 }, { "x":251, "y":1375 }, { "x":253, "y":1407 }, { "x":257, "y":1443 } ], - [ { "x":339, "y":1629 }, { "x":270, "y":1594 }, { "x":50, "y":2013 }, { "x":76, "y":2042 }, { "x":437, "y":1931 }, { "x":446, "y":1880 }, { "x":437, "y":1779 }, { "x":398, "y":1692 } ], - [ { "x":198, "y":1270 }, { "x":210, "y":1302 }, { "x":251, "y":1375 }, { "x":221, "y":1291 }, { "x":194, "y":1233 } ], - [ { "x":24, "y":1971 }, { "x":50, "y":2013 }, { "x":8, "y":1927 } ], - [ { "x":213, "y":1520 }, { "x":215, "y":1499 }, { "x":209, "y":1480 }, { "x":197, "y":1506 } ], - [ { "x":215, "y":1499 }, { "x":257, "y":1443 }, { "x":245, "y":1433 }, { "x":209, "y":1480 } ], - [ { "x":245, "y":1433 }, { "x":257, "y":1443 }, { "x":253, "y":1407 } ], - [ { "x":268, "y":1380 }, { "x":221, "y":1291 }, { "x":251, "y":1375 } ], - [ { "x":221, "y":1291 }, { "x":208, "y":1234 }, { "x":194, "y":1233 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1233 }, { "x":208, "y":1234 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1567 }, { "x":192, "y":1570 }, { "x":225, "y":1552 }, { "x":183, "y":1553 } ], - [ { "x":291, "y":1578 }, { "x":286, "y":1557 }, { "x":224, "y":1534 }, { "x":225, "y":1552 }, { "x":270, "y":1594 } ], - [ { "x":202, "y":1533 }, { "x":225, "y":1552 }, { "x":224, "y":1534 }, { "x":213, "y":1520 }, { "x":197, "y":1506 } ], - [ { "x":192, "y":1570 }, { "x":185, "y":1594 }, { "x":270, "y":1594 }, { "x":225, "y":1552 } ], - [ { "x":202, "y":2098 }, { "x":285, "y":2090 }, { "x":332, "y":2070 }, { "x":371, "y":2041 }, { "x":422, "y":1971 }, { "x":437, "y":1931 }, { "x":76, "y":2042 }, { "x":123, "y":2075 } ], - [ { "x":120, "y":1620 }, { "x":60, "y":1675 }, { "x":19, "y":1748 }, { "x":0, "y":1832 }, { "x":8, "y":1927 }, { "x":50, "y":2013 }, { "x":270, "y":1594 }, { "x":185, "y":1594 } ], - [ { "x":269, "y":1409 }, { "x":268, "y":1380 }, { "x":251, "y":1375 }, { "x":253, "y":1407 }, { "x":257, "y":1443 } ], - [ { "x":339, "y":1629 }, { "x":270, "y":1594 }, { "x":50, "y":2013 }, { "x":76, "y":2042 }, { "x":437, "y":1931 }, { "x":446, "y":1880 }, { "x":437, "y":1779 }, { "x":398, "y":1692 } ], - [ { "x":198, "y":1270 }, { "x":210, "y":1302 }, { "x":251, "y":1375 }, { "x":221, "y":1291 }, { "x":194, "y":1233 } ], - [ { "x":24, "y":1971 }, { "x":50, "y":2013 }, { "x":8, "y":1927 } ], - [ { "x":213, "y":1520 }, { "x":215, "y":1499 }, { "x":209, "y":1480 }, { "x":197, "y":1506 } ], - [ { "x":215, "y":1499 }, { "x":257, "y":1443 }, { "x":245, "y":1433 }, { "x":209, "y":1480 } ], - [ { "x":245, "y":1433 }, { "x":257, "y":1443 }, { "x":253, "y":1407 } ], - [ { "x":268, "y":1380 }, { "x":221, "y":1291 }, { "x":251, "y":1375 } ], - [ { "x":221, "y":1291 }, { "x":208, "y":1234 }, { "x":194, "y":1233 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1233 }, { "x":208, "y":1234 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1567 }, { "x":192, "y":1570 }, { "x":225, "y":1552 }, { "x":183, "y":1553 } ], - [ { "x":291, "y":1578 }, { "x":286, "y":1557 }, { "x":224, "y":1534 }, { "x":225, "y":1552 }, { "x":270, "y":1594 } ], - [ { "x":202, "y":1533 }, { "x":225, "y":1552 }, { "x":224, "y":1534 }, { "x":213, "y":1520 }, { "x":197, "y":1506 } ], - [ { "x":192, "y":1570 }, { "x":185, "y":1594 }, { "x":270, "y":1594 }, { "x":225, "y":1552 } ], - [ { "x":202, "y":2098 }, { "x":285, "y":2090 }, { "x":332, "y":2070 }, { "x":371, "y":2041 }, { "x":422, "y":1971 }, { "x":437, "y":1931 }, { "x":76, "y":2042 }, { "x":123, "y":2075 } ], - [ { "x":120, "y":1620 }, { "x":60, "y":1675 }, { "x":19, "y":1748 }, { "x":0, "y":1832 }, { "x":8, "y":1927 }, { "x":50, "y":2013 }, { "x":270, "y":1594 }, { "x":185, "y":1594 } ], - [ { "x":269, "y":1409 }, { "x":268, "y":1380 }, { "x":251, "y":1375 }, { "x":253, "y":1407 }, { "x":257, "y":1443 } ], - [ { "x":339, "y":1629 }, { "x":270, "y":1594 }, { "x":50, "y":2013 }, { "x":76, "y":2042 }, { "x":437, "y":1931 }, { "x":446, "y":1880 }, { "x":437, "y":1779 }, { "x":398, "y":1692 } ], - [ { "x":198, "y":1270 }, { "x":210, "y":1302 }, { "x":251, "y":1375 }, { "x":221, "y":1291 }, { "x":194, "y":1233 } ], - [ { "x":24, "y":1971 }, { "x":50, "y":2013 }, { "x":8, "y":1927 } ], - [ { "x":213, "y":1520 }, { "x":215, "y":1499 }, { "x":209, "y":1480 }, { "x":197, "y":1506 } ], - [ { "x":215, "y":1499 }, { "x":257, "y":1443 }, { "x":245, "y":1433 }, { "x":209, "y":1480 } ], - [ { "x":245, "y":1433 }, { "x":257, "y":1443 }, { "x":253, "y":1407 } ], - [ { "x":268, "y":1380 }, { "x":221, "y":1291 }, { "x":251, "y":1375 } ], - [ { "x":221, "y":1291 }, { "x":208, "y":1234 }, { "x":194, "y":1233 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1233 }, { "x":208, "y":1234 }, { "x":208, "y":0 } ] - ] - } - ] - }, - "pipe2": { - "type": "fromPhysicsEditor", - "label": "pipe2", - "isStatic": false, - "density": 0.10000000149011612, - "restitution": 0, - "friction": 0.10000000149011612, - "frictionAir": 0.009999999776482582, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":186, "y":1581 }, { "x":186, "y":1591 }, { "x":192, "y":1581 } ], - [ { "x":410, "y":1991 }, { "x":410, "y":1989 }, { "x":408, "y":1992 } ], - [ { "x":291, "y":1600 }, { "x":288, "y":1600 }, { "x":293, "y":1602 } ], - [ { "x":47, "y":1691 }, { "x":46, "y":1695 }, { "x":50, "y":1689 } ], - [ { "x":206, "y":1482 }, { "x":205, "y":1486 }, { "x":209, "y":1480 } ], - [ { "x":180, "y":1564 }, { "x":185, "y":1568 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":184, "y":1550 }, { "x":180, "y":1554 } ], - [ { "x":248, "y":1455 }, { "x":248, "y":1453 }, { "x":245, "y":1457 } ], - [ { "x":225, "y":1484 }, { "x":225, "y":1482 }, { "x":222, "y":1486 } ], - [ { "x":57, "y":1677 }, { "x":57, "y":1679 }, { "x":60, "y":1675 } ], - [ { "x":228, "y":1454 }, { "x":228, "y":1456 }, { "x":233, "y":1472 }, { "x":231, "y":1452 } ], - [ { "x":231, "y":1450 }, { "x":231, "y":1452 }, { "x":233, "y":1472 }, { "x":234, "y":1448 } ], - [ { "x":234, "y":1446 }, { "x":234, "y":1448 }, { "x":237, "y":1444 } ], - [ { "x":291, "y":1576 }, { "x":291, "y":1564 }, { "x":284, "y":1553 }, { "x":266, "y":1545 }, { "x":233, "y":1537 }, { "x":266, "y":1593 }, { "x":274, "y":1591 }, { "x":284, "y":1586 } ], - [ { "x":234, "y":1312 }, { "x":232, "y":1311 }, { "x":235, "y":1316 } ], - [ { "x":109, "y":2065 }, { "x":113, "y":2066 }, { "x":305, "y":2080 }, { "x":407, "y":1704 }, { "x":405, "y":1703 }, { "x":18, "y":1752 }, { "x":16, "y":1754 }, { "x":108, "y":2063 } ], - [ { "x":123, "y":1616 }, { "x":122, "y":1618 }, { "x":127, "y":1615 } ], - [ { "x":192, "y":1568 }, { "x":192, "y":1581 }, { "x":225, "y":1550 } ], - [ { "x":245, "y":1459 }, { "x":245, "y":1457 }, { "x":241, "y":1462 } ], - [ { "x":233, "y":1474 }, { "x":233, "y":1472 }, { "x":229, "y":1477 } ], - [ { "x":229, "y":1479 }, { "x":229, "y":1477 }, { "x":225, "y":1482 } ], - [ { "x":60, "y":1673 }, { "x":60, "y":1675 }, { "x":64, "y":1670 } ], - [ { "x":104, "y":1629 }, { "x":101, "y":1633 }, { "x":106, "y":1629 } ], - [ { "x":215, "y":1470 }, { "x":215, "y":1472 }, { "x":219, "y":1467 } ], - [ { "x":219, "y":1465 }, { "x":219, "y":1467 }, { "x":223, "y":1462 } ], - [ { "x":108, "y":1626 }, { "x":106, "y":1629 }, { "x":113, "y":1624 } ], - [ { "x":251, "y":1339 }, { "x":247, "y":1335 }, { "x":254, "y":1386 }, { "x":262, "y":1431 }, { "x":252, "y":1343 } ], - [ { "x":234, "y":1343 }, { "x":238, "y":1347 }, { "x":233, "y":1339 } ], - [ { "x":222, "y":1324 }, { "x":226, "y":1328 }, { "x":221, "y":1320 } ], - [ { "x":238, "y":1468 }, { "x":241, "y":1462 }, { "x":233, "y":1472 } ], - [ { "x":347, "y":1633 }, { "x":345, "y":1633 }, { "x":351, "y":1638 } ], - [ { "x":223, "y":1460 }, { "x":223, "y":1462 }, { "x":228, "y":1456 } ], - [ { "x":118, "y":1619 }, { "x":113, "y":1624 }, { "x":122, "y":1618 } ], - [ { "x":128, "y":1613 }, { "x":127, "y":1615 }, { "x":134, "y":1611 } ], - [ { "x":219, "y":1319 }, { "x":221, "y":1320 }, { "x":193, "y":1231 }, { "x":217, "y":1313 } ], - [ { "x":303, "y":2082 }, { "x":305, "y":2080 }, { "x":113, "y":2066 }, { "x":149, "y":2083 }, { "x":297, "y":2083 } ], - [ { "x":143, "y":2082 }, { "x":149, "y":2083 }, { "x":141, "y":2080 } ], - [ { "x":34, "y":1988 }, { "x":38, "y":1992 }, { "x":31, "y":1980 } ], - [ { "x":203, "y":1533 }, { "x":211, "y":1542 }, { "x":225, "y":1550 }, { "x":222, "y":1531 }, { "x":214, "y":1521 }, { "x":197, "y":1504 }, { "x":198, "y":1521 } ], - [ { "x":135, "y":1609 }, { "x":134, "y":1611 }, { "x":144, "y":1606 }, { "x":141, "y":1606 } ], - [ { "x":203, "y":1487 }, { "x":200, "y":1493 }, { "x":197, "y":1504 }, { "x":205, "y":1486 } ], - [ { "x":237, "y":1317 }, { "x":235, "y":1316 }, { "x":249, "y":1368 }, { "x":240, "y":1324 } ], - [ { "x":412, "y":1988 }, { "x":415, "y":1980 }, { "x":410, "y":1989 } ], - [ { "x":362, "y":2047 }, { "x":368, "y":2040 }, { "x":360, "y":2047 } ], - [ { "x":84, "y":2047 }, { "x":86, "y":2047 }, { "x":78, "y":2040 } ], - [ { "x":392, "y":1681 }, { "x":386, "y":1675 }, { "x":392, "y":1683 } ], - [ { "x":289, "y":2087 }, { "x":297, "y":2083 }, { "x":149, "y":2083 } ], - [ { "x":209, "y":1478 }, { "x":209, "y":1480 }, { "x":215, "y":1472 } ], - [ { "x":342, "y":1629 }, { "x":293, "y":1602 }, { "x":345, "y":1633 } ], - [ { "x":269, "y":1407 }, { "x":269, "y":1384 }, { "x":265, "y":1367 }, { "x":254, "y":1344 }, { "x":252, "y":1343 }, { "x":262, "y":1431 } ], - [ { "x":407, "y":1996 }, { "x":408, "y":1992 }, { "x":305, "y":2080 }, { "x":360, "y":2047 }, { "x":368, "y":2040 } ], - [ { "x":39, "y":1704 }, { "x":36, "y":1712 }, { "x":46, "y":1695 } ], - [ { "x":43, "y":2002 }, { "x":48, "y":2007 }, { "x":38, "y":1992 } ], - [ { "x":222, "y":1488 }, { "x":222, "y":1486 }, { "x":197, "y":1504 }, { "x":216, "y":1495 } ], - [ { "x":277, "y":1595 }, { "x":266, "y":1593 }, { "x":288, "y":1600 } ], - [ { "x":97, "y":2057 }, { "x":108, "y":2063 }, { "x":86, "y":2047 } ], - [ { "x":50, "y":1687 }, { "x":50, "y":1689 }, { "x":57, "y":1679 } ], - [ { "x":337, "y":2065 }, { "x":347, "y":2057 }, { "x":333, "y":2066 } ], - [ { "x":242, "y":1325 }, { "x":240, "y":1324 }, { "x":249, "y":1368 }, { "x":254, "y":1386 }, { "x":247, "y":1335 } ], - [ { "x":242, "y":1434 }, { "x":237, "y":1444 }, { "x":233, "y":1472 }, { "x":241, "y":1462 }, { "x":262, "y":1431 }, { "x":244, "y":1433 } ], - [ { "x":231, "y":1338 }, { "x":233, "y":1339 }, { "x":193, "y":1231 }, { "x":226, "y":1328 } ], - [ { "x":417, "y":1979 }, { "x":423, "y":1967 }, { "x":423, "y":1964 }, { "x":407, "y":1704 }, { "x":415, "y":1980 } ], - [ { "x":29, "y":1979 }, { "x":31, "y":1980 }, { "x":23, "y":1964 }, { "x":23, "y":1967 } ], - [ { "x":23, "y":1736 }, { "x":18, "y":1752 }, { "x":27, "y":1730 } ], - [ { "x":233, "y":1537 }, { "x":222, "y":1531 }, { "x":225, "y":1550 }, { "x":266, "y":1593 } ], - [ { "x":349, "y":2057 }, { "x":360, "y":2047 }, { "x":347, "y":2057 } ], - [ { "x":160, "y":1598 }, { "x":134, "y":1611 }, { "x":122, "y":1618 }, { "x":18, "y":1752 }, { "x":405, "y":1703 }, { "x":186, "y":1591 } ], - [ { "x":196, "y":1259 }, { "x":204, "y":1288 }, { "x":215, "y":1312 }, { "x":217, "y":1313 }, { "x":193, "y":1231 } ], - [ { "x":34, "y":1713 }, { "x":27, "y":1727 }, { "x":27, "y":1730 }, { "x":36, "y":1712 } ], - [ { "x":254, "y":1446 }, { "x":262, "y":1431 }, { "x":248, "y":1453 } ], - [ { "x":398, "y":2009 }, { "x":400, "y":2004 }, { "x":368, "y":2040 } ], - [ { "x":446, "y":1830 }, { "x":439, "y":1785 }, { "x":427, "y":1746 }, { "x":407, "y":1704 }, { "x":423, "y":1964 }, { "x":443, "y":1902 }, { "x":446, "y":1878 } ], - [ { "x":404, "y":1699 }, { "x":386, "y":1675 }, { "x":351, "y":1638 }, { "x":293, "y":1602 }, { "x":266, "y":1593 }, { "x":186, "y":1591 }, { "x":405, "y":1703 } ], - [ { "x":384, "y":2026 }, { "x":384, "y":2024 }, { "x":368, "y":2040 }, { "x":370, "y":2040 } ], - [ { "x":76, "y":2040 }, { "x":78, "y":2040 }, { "x":62, "y":2024 }, { "x":62, "y":2026 } ], - [ { "x":270, "y":2092 }, { "x":285, "y":2087 }, { "x":149, "y":2083 }, { "x":181, "y":2093 }, { "x":202, "y":2096 }, { "x":244, "y":2096 } ], - [ { "x":48, "y":2009 }, { "x":78, "y":2040 }, { "x":48, "y":2007 } ], - [ { "x":5, "y":1794 }, { "x":0, "y":1830 }, { "x":0, "y":1878 }, { "x":3, "y":1902 }, { "x":19, "y":1958 }, { "x":23, "y":1964 }, { "x":108, "y":2063 }, { "x":16, "y":1754 } ], - [ { "x":429, "y":1953 }, { "x":437, "y":1929 }, { "x":443, "y":1902 }, { "x":423, "y":1964 } ], - [ { "x":157, "y":2087 }, { "x":181, "y":2093 }, { "x":149, "y":2083 } ], - [ { "x":192, "y":1581 }, { "x":186, "y":1591 }, { "x":266, "y":1593 }, { "x":225, "y":1550 } ], - [ { "x":9, "y":1929 }, { "x":19, "y":1958 }, { "x":3, "y":1902 } ], - [ { "x":328, "y":1619 }, { "x":296, "y":1602 }, { "x":293, "y":1602 }, { "x":333, "y":1624 } ], - [ { "x":332, "y":2068 }, { "x":333, "y":2066 }, { "x":305, "y":2080 }, { "x":308, "y":2080 } ], - [ { "x":114, "y":2068 }, { "x":138, "y":2080 }, { "x":141, "y":2080 }, { "x":113, "y":2066 } ], - [ { "x":205, "y":1486 }, { "x":197, "y":1504 }, { "x":233, "y":1472 }, { "x":228, "y":1456 }, { "x":209, "y":1480 } ], - [ { "x":48, "y":2007 }, { "x":78, "y":2040 }, { "x":86, "y":2047 }, { "x":108, "y":2063 }, { "x":23, "y":1964 }, { "x":31, "y":1980 }, { "x":38, "y":1992 } ], - [ { "x":347, "y":2057 }, { "x":360, "y":2047 }, { "x":305, "y":2080 }, { "x":333, "y":2066 } ], - [ { "x":27, "y":1730 }, { "x":18, "y":1752 }, { "x":122, "y":1618 }, { "x":50, "y":1689 }, { "x":46, "y":1695 }, { "x":36, "y":1712 } ], - [ { "x":353, "y":1638 }, { "x":351, "y":1638 }, { "x":386, "y":1675 }, { "x":386, "y":1673 } ], - [ { "x":64, "y":1668 }, { "x":64, "y":1670 }, { "x":101, "y":1633 }, { "x":99, "y":1633 } ], - [ { "x":106, "y":1629 }, { "x":101, "y":1633 }, { "x":64, "y":1670 }, { "x":57, "y":1679 }, { "x":50, "y":1689 }, { "x":122, "y":1618 } ], - [ { "x":141, "y":2080 }, { "x":149, "y":2083 }, { "x":113, "y":2066 } ], - [ { "x":410, "y":1989 }, { "x":415, "y":1980 }, { "x":407, "y":1704 }, { "x":305, "y":2080 }, { "x":408, "y":1992 } ], - [ { "x":221, "y":1320 }, { "x":226, "y":1328 }, { "x":193, "y":1231 } ], - [ { "x":345, "y":1633 }, { "x":293, "y":1602 }, { "x":351, "y":1638 } ], - [ { "x":233, "y":1339 }, { "x":238, "y":1347 }, { "x":193, "y":1231 } ], - [ { "x":238, "y":1347 }, { "x":249, "y":1368 }, { "x":220, "y":1287 }, { "x":193, "y":1231 } ], - [ { "x":288, "y":1600 }, { "x":266, "y":1593 }, { "x":293, "y":1602 } ], - [ { "x":248, "y":1453 }, { "x":262, "y":1431 }, { "x":241, "y":1462 } ], - [ { "x":60, "y":1675 }, { "x":57, "y":1679 }, { "x":64, "y":1670 } ], - [ { "x":193, "y":0 }, { "x":193, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ], - [ { "x":208, "y":1232 }, { "x":193, "y":1231 }, { "x":211, "y":1257 } ], - [ { "x":211, "y":1257 }, { "x":193, "y":1231 }, { "x":220, "y":1287 } ], - [ { "x":220, "y":1287 }, { "x":249, "y":1368 }, { "x":232, "y":1311 } ], - [ { "x":232, "y":1311 }, { "x":249, "y":1368 }, { "x":235, "y":1316 } ], - [ { "x":254, "y":1386 }, { "x":254, "y":1405 }, { "x":262, "y":1431 } ], - [ { "x":254, "y":1405 }, { "x":249, "y":1423 }, { "x":262, "y":1431 } ], - [ { "x":249, "y":1423 }, { "x":244, "y":1433 }, { "x":262, "y":1431 } ], - [ { "x":237, "y":1444 }, { "x":234, "y":1448 }, { "x":233, "y":1472 } ], - [ { "x":233, "y":1472 }, { "x":197, "y":1504 }, { "x":225, "y":1482 } ], - [ { "x":225, "y":1482 }, { "x":197, "y":1504 }, { "x":222, "y":1486 } ], - [ { "x":216, "y":1495 }, { "x":197, "y":1504 }, { "x":212, "y":1505 } ], - [ { "x":212, "y":1505 }, { "x":197, "y":1504 }, { "x":214, "y":1521 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - } - ] - }, - "pipe3": { - "type": "fromPhysicsEditor", - "label": "pipe3", - "isStatic": false, - "density": 0.10000000149011612, - "restitution": 0, - "friction": 0.10000000149011612, - "frictionAir": 0.009999999776482582, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":186, "y":1581 }, { "x":186, "y":1591 }, { "x":192, "y":1581 } ], - [ { "x":410, "y":1991 }, { "x":410, "y":1989 }, { "x":408, "y":1992 } ], - [ { "x":291, "y":1600 }, { "x":288, "y":1600 }, { "x":293, "y":1602 } ], - [ { "x":47, "y":1691 }, { "x":46, "y":1695 }, { "x":50, "y":1689 } ], - [ { "x":206, "y":1482 }, { "x":205, "y":1486 }, { "x":209, "y":1480 } ], - [ { "x":180, "y":1564 }, { "x":185, "y":1568 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":184, "y":1550 }, { "x":180, "y":1554 } ], - [ { "x":248, "y":1455 }, { "x":248, "y":1453 }, { "x":245, "y":1457 } ], - [ { "x":225, "y":1484 }, { "x":225, "y":1482 }, { "x":222, "y":1486 } ], - [ { "x":57, "y":1677 }, { "x":57, "y":1679 }, { "x":60, "y":1675 } ], - [ { "x":228, "y":1454 }, { "x":228, "y":1456 }, { "x":233, "y":1472 }, { "x":231, "y":1452 } ], - [ { "x":231, "y":1450 }, { "x":231, "y":1452 }, { "x":233, "y":1472 }, { "x":234, "y":1448 } ], - [ { "x":234, "y":1446 }, { "x":234, "y":1448 }, { "x":237, "y":1444 } ], - [ { "x":291, "y":1576 }, { "x":291, "y":1564 }, { "x":284, "y":1553 }, { "x":266, "y":1545 }, { "x":233, "y":1537 }, { "x":266, "y":1593 }, { "x":274, "y":1591 }, { "x":284, "y":1586 } ], - [ { "x":234, "y":1312 }, { "x":232, "y":1311 }, { "x":235, "y":1316 } ], - [ { "x":109, "y":2065 }, { "x":113, "y":2066 }, { "x":305, "y":2080 }, { "x":407, "y":1704 }, { "x":405, "y":1703 }, { "x":18, "y":1752 }, { "x":16, "y":1754 }, { "x":108, "y":2063 } ], - [ { "x":123, "y":1616 }, { "x":122, "y":1618 }, { "x":127, "y":1615 } ], - [ { "x":192, "y":1568 }, { "x":192, "y":1581 }, { "x":225, "y":1550 } ], - [ { "x":245, "y":1459 }, { "x":245, "y":1457 }, { "x":241, "y":1462 } ], - [ { "x":233, "y":1474 }, { "x":233, "y":1472 }, { "x":229, "y":1477 } ], - [ { "x":229, "y":1479 }, { "x":229, "y":1477 }, { "x":225, "y":1482 } ], - [ { "x":60, "y":1673 }, { "x":60, "y":1675 }, { "x":64, "y":1670 } ], - [ { "x":104, "y":1629 }, { "x":101, "y":1633 }, { "x":106, "y":1629 } ], - [ { "x":215, "y":1470 }, { "x":215, "y":1472 }, { "x":219, "y":1467 } ], - [ { "x":219, "y":1465 }, { "x":219, "y":1467 }, { "x":223, "y":1462 } ], - [ { "x":108, "y":1626 }, { "x":106, "y":1629 }, { "x":113, "y":1624 } ], - [ { "x":251, "y":1339 }, { "x":247, "y":1335 }, { "x":254, "y":1386 }, { "x":262, "y":1431 }, { "x":252, "y":1343 } ], - [ { "x":234, "y":1343 }, { "x":238, "y":1347 }, { "x":233, "y":1339 } ], - [ { "x":222, "y":1324 }, { "x":226, "y":1328 }, { "x":221, "y":1320 } ], - [ { "x":238, "y":1468 }, { "x":241, "y":1462 }, { "x":233, "y":1472 } ], - [ { "x":347, "y":1633 }, { "x":345, "y":1633 }, { "x":351, "y":1638 } ], - [ { "x":223, "y":1460 }, { "x":223, "y":1462 }, { "x":228, "y":1456 } ], - [ { "x":118, "y":1619 }, { "x":113, "y":1624 }, { "x":122, "y":1618 } ], - [ { "x":128, "y":1613 }, { "x":127, "y":1615 }, { "x":134, "y":1611 } ], - [ { "x":219, "y":1319 }, { "x":221, "y":1320 }, { "x":193, "y":1231 }, { "x":217, "y":1313 } ], - [ { "x":303, "y":2082 }, { "x":305, "y":2080 }, { "x":113, "y":2066 }, { "x":149, "y":2083 }, { "x":297, "y":2083 } ], - [ { "x":143, "y":2082 }, { "x":149, "y":2083 }, { "x":141, "y":2080 } ], - [ { "x":34, "y":1988 }, { "x":38, "y":1992 }, { "x":31, "y":1980 } ], - [ { "x":203, "y":1533 }, { "x":211, "y":1542 }, { "x":225, "y":1550 }, { "x":222, "y":1531 }, { "x":214, "y":1521 }, { "x":197, "y":1504 }, { "x":198, "y":1521 } ], - [ { "x":135, "y":1609 }, { "x":134, "y":1611 }, { "x":144, "y":1606 }, { "x":141, "y":1606 } ], - [ { "x":203, "y":1487 }, { "x":200, "y":1493 }, { "x":197, "y":1504 }, { "x":205, "y":1486 } ], - [ { "x":237, "y":1317 }, { "x":235, "y":1316 }, { "x":249, "y":1368 }, { "x":240, "y":1324 } ], - [ { "x":412, "y":1988 }, { "x":415, "y":1980 }, { "x":410, "y":1989 } ], - [ { "x":362, "y":2047 }, { "x":368, "y":2040 }, { "x":360, "y":2047 } ], - [ { "x":84, "y":2047 }, { "x":86, "y":2047 }, { "x":78, "y":2040 } ], - [ { "x":392, "y":1681 }, { "x":386, "y":1675 }, { "x":392, "y":1683 } ], - [ { "x":289, "y":2087 }, { "x":297, "y":2083 }, { "x":149, "y":2083 } ], - [ { "x":209, "y":1478 }, { "x":209, "y":1480 }, { "x":215, "y":1472 } ], - [ { "x":342, "y":1629 }, { "x":293, "y":1602 }, { "x":345, "y":1633 } ], - [ { "x":269, "y":1407 }, { "x":269, "y":1384 }, { "x":265, "y":1367 }, { "x":254, "y":1344 }, { "x":252, "y":1343 }, { "x":262, "y":1431 } ], - [ { "x":407, "y":1996 }, { "x":408, "y":1992 }, { "x":305, "y":2080 }, { "x":360, "y":2047 }, { "x":368, "y":2040 } ], - [ { "x":39, "y":1704 }, { "x":36, "y":1712 }, { "x":46, "y":1695 } ], - [ { "x":43, "y":2002 }, { "x":48, "y":2007 }, { "x":38, "y":1992 } ], - [ { "x":222, "y":1488 }, { "x":222, "y":1486 }, { "x":197, "y":1504 }, { "x":216, "y":1495 } ], - [ { "x":277, "y":1595 }, { "x":266, "y":1593 }, { "x":288, "y":1600 } ], - [ { "x":97, "y":2057 }, { "x":108, "y":2063 }, { "x":86, "y":2047 } ], - [ { "x":50, "y":1687 }, { "x":50, "y":1689 }, { "x":57, "y":1679 } ], - [ { "x":337, "y":2065 }, { "x":347, "y":2057 }, { "x":333, "y":2066 } ], - [ { "x":242, "y":1325 }, { "x":240, "y":1324 }, { "x":249, "y":1368 }, { "x":254, "y":1386 }, { "x":247, "y":1335 } ], - [ { "x":242, "y":1434 }, { "x":237, "y":1444 }, { "x":233, "y":1472 }, { "x":241, "y":1462 }, { "x":262, "y":1431 }, { "x":244, "y":1433 } ], - [ { "x":231, "y":1338 }, { "x":233, "y":1339 }, { "x":193, "y":1231 }, { "x":226, "y":1328 } ], - [ { "x":417, "y":1979 }, { "x":423, "y":1967 }, { "x":423, "y":1964 }, { "x":407, "y":1704 }, { "x":415, "y":1980 } ], - [ { "x":29, "y":1979 }, { "x":31, "y":1980 }, { "x":23, "y":1964 }, { "x":23, "y":1967 } ], - [ { "x":23, "y":1736 }, { "x":18, "y":1752 }, { "x":27, "y":1730 } ], - [ { "x":233, "y":1537 }, { "x":222, "y":1531 }, { "x":225, "y":1550 }, { "x":266, "y":1593 } ], - [ { "x":349, "y":2057 }, { "x":360, "y":2047 }, { "x":347, "y":2057 } ], - [ { "x":160, "y":1598 }, { "x":134, "y":1611 }, { "x":122, "y":1618 }, { "x":18, "y":1752 }, { "x":405, "y":1703 }, { "x":186, "y":1591 } ], - [ { "x":196, "y":1259 }, { "x":204, "y":1288 }, { "x":215, "y":1312 }, { "x":217, "y":1313 }, { "x":193, "y":1231 } ], - [ { "x":34, "y":1713 }, { "x":27, "y":1727 }, { "x":27, "y":1730 }, { "x":36, "y":1712 } ], - [ { "x":254, "y":1446 }, { "x":262, "y":1431 }, { "x":248, "y":1453 } ], - [ { "x":398, "y":2009 }, { "x":400, "y":2004 }, { "x":368, "y":2040 } ], - [ { "x":446, "y":1830 }, { "x":439, "y":1785 }, { "x":427, "y":1746 }, { "x":407, "y":1704 }, { "x":423, "y":1964 }, { "x":443, "y":1902 }, { "x":446, "y":1878 } ], - [ { "x":404, "y":1699 }, { "x":386, "y":1675 }, { "x":351, "y":1638 }, { "x":293, "y":1602 }, { "x":266, "y":1593 }, { "x":186, "y":1591 }, { "x":405, "y":1703 } ], - [ { "x":384, "y":2026 }, { "x":384, "y":2024 }, { "x":368, "y":2040 }, { "x":370, "y":2040 } ], - [ { "x":76, "y":2040 }, { "x":78, "y":2040 }, { "x":62, "y":2024 }, { "x":62, "y":2026 } ], - [ { "x":270, "y":2092 }, { "x":285, "y":2087 }, { "x":149, "y":2083 }, { "x":181, "y":2093 }, { "x":202, "y":2096 }, { "x":244, "y":2096 } ], - [ { "x":48, "y":2009 }, { "x":78, "y":2040 }, { "x":48, "y":2007 } ], - [ { "x":5, "y":1794 }, { "x":0, "y":1830 }, { "x":0, "y":1878 }, { "x":3, "y":1902 }, { "x":19, "y":1958 }, { "x":23, "y":1964 }, { "x":108, "y":2063 }, { "x":16, "y":1754 } ], - [ { "x":429, "y":1953 }, { "x":437, "y":1929 }, { "x":443, "y":1902 }, { "x":423, "y":1964 } ], - [ { "x":157, "y":2087 }, { "x":181, "y":2093 }, { "x":149, "y":2083 } ], - [ { "x":192, "y":1581 }, { "x":186, "y":1591 }, { "x":266, "y":1593 }, { "x":225, "y":1550 } ], - [ { "x":9, "y":1929 }, { "x":19, "y":1958 }, { "x":3, "y":1902 } ], - [ { "x":328, "y":1619 }, { "x":296, "y":1602 }, { "x":293, "y":1602 }, { "x":333, "y":1624 } ], - [ { "x":332, "y":2068 }, { "x":333, "y":2066 }, { "x":305, "y":2080 }, { "x":308, "y":2080 } ], - [ { "x":114, "y":2068 }, { "x":138, "y":2080 }, { "x":141, "y":2080 }, { "x":113, "y":2066 } ], - [ { "x":205, "y":1486 }, { "x":197, "y":1504 }, { "x":233, "y":1472 }, { "x":228, "y":1456 }, { "x":209, "y":1480 } ], - [ { "x":48, "y":2007 }, { "x":78, "y":2040 }, { "x":86, "y":2047 }, { "x":108, "y":2063 }, { "x":23, "y":1964 }, { "x":31, "y":1980 }, { "x":38, "y":1992 } ], - [ { "x":347, "y":2057 }, { "x":360, "y":2047 }, { "x":305, "y":2080 }, { "x":333, "y":2066 } ], - [ { "x":27, "y":1730 }, { "x":18, "y":1752 }, { "x":122, "y":1618 }, { "x":50, "y":1689 }, { "x":46, "y":1695 }, { "x":36, "y":1712 } ], - [ { "x":353, "y":1638 }, { "x":351, "y":1638 }, { "x":386, "y":1675 }, { "x":386, "y":1673 } ], - [ { "x":64, "y":1668 }, { "x":64, "y":1670 }, { "x":101, "y":1633 }, { "x":99, "y":1633 } ], - [ { "x":106, "y":1629 }, { "x":101, "y":1633 }, { "x":64, "y":1670 }, { "x":57, "y":1679 }, { "x":50, "y":1689 }, { "x":122, "y":1618 } ], - [ { "x":141, "y":2080 }, { "x":149, "y":2083 }, { "x":113, "y":2066 } ], - [ { "x":410, "y":1989 }, { "x":415, "y":1980 }, { "x":407, "y":1704 }, { "x":305, "y":2080 }, { "x":408, "y":1992 } ], - [ { "x":221, "y":1320 }, { "x":226, "y":1328 }, { "x":193, "y":1231 } ], - [ { "x":345, "y":1633 }, { "x":293, "y":1602 }, { "x":351, "y":1638 } ], - [ { "x":233, "y":1339 }, { "x":238, "y":1347 }, { "x":193, "y":1231 } ], - [ { "x":238, "y":1347 }, { "x":249, "y":1368 }, { "x":220, "y":1287 }, { "x":193, "y":1231 } ], - [ { "x":288, "y":1600 }, { "x":266, "y":1593 }, { "x":293, "y":1602 } ], - [ { "x":248, "y":1453 }, { "x":262, "y":1431 }, { "x":241, "y":1462 } ], - [ { "x":60, "y":1675 }, { "x":57, "y":1679 }, { "x":64, "y":1670 } ], - [ { "x":193, "y":0 }, { "x":193, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ], - [ { "x":208, "y":1232 }, { "x":193, "y":1231 }, { "x":211, "y":1257 } ], - [ { "x":211, "y":1257 }, { "x":193, "y":1231 }, { "x":220, "y":1287 } ], - [ { "x":220, "y":1287 }, { "x":249, "y":1368 }, { "x":232, "y":1311 } ], - [ { "x":232, "y":1311 }, { "x":249, "y":1368 }, { "x":235, "y":1316 } ], - [ { "x":254, "y":1386 }, { "x":254, "y":1405 }, { "x":262, "y":1431 } ], - [ { "x":254, "y":1405 }, { "x":249, "y":1423 }, { "x":262, "y":1431 } ], - [ { "x":249, "y":1423 }, { "x":244, "y":1433 }, { "x":262, "y":1431 } ], - [ { "x":237, "y":1444 }, { "x":234, "y":1448 }, { "x":233, "y":1472 } ], - [ { "x":233, "y":1472 }, { "x":197, "y":1504 }, { "x":225, "y":1482 } ], - [ { "x":225, "y":1482 }, { "x":197, "y":1504 }, { "x":222, "y":1486 } ], - [ { "x":216, "y":1495 }, { "x":197, "y":1504 }, { "x":212, "y":1505 } ], - [ { "x":212, "y":1505 }, { "x":197, "y":1504 }, { "x":214, "y":1521 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - }, - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":182, "y":1565 }, { "x":192, "y":1568 }, { "x":225, "y":1550 }, { "x":183, "y":1551 } ], - [ { "x":291, "y":1576 }, { "x":286, "y":1555 }, { "x":224, "y":1532 }, { "x":225, "y":1550 }, { "x":270, "y":1592 } ], - [ { "x":202, "y":1531 }, { "x":225, "y":1550 }, { "x":224, "y":1532 }, { "x":213, "y":1518 }, { "x":197, "y":1504 } ], - [ { "x":192, "y":1568 }, { "x":185, "y":1592 }, { "x":270, "y":1592 }, { "x":225, "y":1550 } ], - [ { "x":202, "y":2096 }, { "x":285, "y":2088 }, { "x":332, "y":2068 }, { "x":371, "y":2039 }, { "x":422, "y":1969 }, { "x":437, "y":1929 }, { "x":76, "y":2040 }, { "x":123, "y":2073 } ], - [ { "x":120, "y":1618 }, { "x":60, "y":1673 }, { "x":19, "y":1746 }, { "x":0, "y":1830 }, { "x":8, "y":1925 }, { "x":50, "y":2011 }, { "x":270, "y":1592 }, { "x":185, "y":1592 } ], - [ { "x":269, "y":1407 }, { "x":268, "y":1378 }, { "x":251, "y":1373 }, { "x":253, "y":1405 }, { "x":257, "y":1441 } ], - [ { "x":339, "y":1627 }, { "x":270, "y":1592 }, { "x":50, "y":2011 }, { "x":76, "y":2040 }, { "x":437, "y":1929 }, { "x":446, "y":1878 }, { "x":437, "y":1777 }, { "x":398, "y":1690 } ], - [ { "x":198, "y":1268 }, { "x":210, "y":1300 }, { "x":251, "y":1373 }, { "x":221, "y":1289 }, { "x":194, "y":1231 } ], - [ { "x":24, "y":1969 }, { "x":50, "y":2011 }, { "x":8, "y":1925 } ], - [ { "x":213, "y":1518 }, { "x":215, "y":1497 }, { "x":209, "y":1478 }, { "x":197, "y":1504 } ], - [ { "x":215, "y":1497 }, { "x":257, "y":1441 }, { "x":245, "y":1431 }, { "x":209, "y":1478 } ], - [ { "x":245, "y":1431 }, { "x":257, "y":1441 }, { "x":253, "y":1405 } ], - [ { "x":268, "y":1378 }, { "x":221, "y":1289 }, { "x":251, "y":1373 } ], - [ { "x":221, "y":1289 }, { "x":208, "y":1232 }, { "x":194, "y":1231 } ], - [ { "x":193, "y":0 }, { "x":194, "y":1231 }, { "x":208, "y":1232 }, { "x":208, "y":0 } ] - ] - } - ] - }, - "clumsy1": { - "type": "fromPhysicsEditor", - "label": "clumsy1", - "isStatic": false, - "density": 0.1, - "restitution": 0, - "friction": 0.1, - "frictionAir": 0.01, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":30, "y":178 }, { "x":37, "y":211 }, { "x":69, "y":174 } ], - [ { "x":124, "y":27 }, { "x":134, "y":59 }, { "x":168, "y":36 }, { "x":144, "y":22 } ], - [ { "x":20, "y":246 }, { "x":24, "y":270 }, { "x":37, "y":281 }, { "x":34, "y":229 } ], - [ { "x":174, "y":19 }, { "x":168, "y":36 }, { "x":193, "y":33 }, { "x":182, "y":19 } ], - [ { "x":363, "y":108 }, { "x":327, "y":103 }, { "x":355, "y":154 }, { "x":386, "y":139 }, { "x":384, "y":130 } ], - [ { "x":56, "y":325 }, { "x":96, "y":351 }, { "x":144, "y":362 }, { "x":215, "y":361 }, { "x":310, "y":77 }, { "x":69, "y":174 }, { "x":34, "y":229 }, { "x":37, "y":281 } ], - [ { "x":374, "y":163 }, { "x":355, "y":154 }, { "x":343, "y":179 }, { "x":372, "y":167 } ], - [ { "x":355, "y":154 }, { "x":327, "y":103 }, { "x":310, "y":77 }, { "x":215, "y":361 }, { "x":250, "y":351 }, { "x":343, "y":179 } ], - [ { "x":168, "y":36 }, { "x":134, "y":59 }, { "x":91, "y":112 }, { "x":69, "y":174 }, { "x":310, "y":77 }, { "x":234, "y":34 }, { "x":193, "y":33 } ], - [ { "x":276, "y":49 }, { "x":234, "y":34 }, { "x":310, "y":77 } ], - [ { "x":288, "y":324 }, { "x":314, "y":287 }, { "x":338, "y":230 }, { "x":343, "y":179 }, { "x":250, "y":351 } ], - [ { "x":37, "y":211 }, { "x":34, "y":229 }, { "x":69, "y":174 } ] - ] - } - ] - }, - "clumsy2": { - "type": "fromPhysicsEditor", - "label": "clumsy2", - "isStatic": false, - "density": 0.10000000149011612, - "restitution": 0, - "friction": 0.10000000149011612, - "frictionAir": 0.009999999776482582, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":124, "y":27 }, { "x":134, "y":59 }, { "x":168, "y":36 }, { "x":144, "y":22 } ], - [ { "x":0, "y":280 }, { "x":3, "y":297 }, { "x":34, "y":321 }, { "x":58, "y":330 }, { "x":24, "y":272 } ], - [ { "x":20, "y":199 }, { "x":36, "y":228 }, { "x":37, "y":194 } ], - [ { "x":16, "y":241 }, { "x":24, "y":272 }, { "x":58, "y":330 }, { "x":115, "y":360 }, { "x":199, "y":365 }, { "x":36, "y":228 } ], - [ { "x":174, "y":19 }, { "x":168, "y":36 }, { "x":193, "y":33 }, { "x":182, "y":19 } ], - [ { "x":363, "y":108 }, { "x":327, "y":103 }, { "x":355, "y":154 }, { "x":386, "y":139 }, { "x":384, "y":130 } ], - [ { "x":40, "y":185 }, { "x":37, "y":194 }, { "x":36, "y":228 }, { "x":199, "y":365 }, { "x":66, "y":183 } ], - [ { "x":66, "y":183 }, { "x":199, "y":365 }, { "x":290, "y":320 }, { "x":314, "y":287 }, { "x":310, "y":77 }, { "x":193, "y":33 }, { "x":134, "y":59 }, { "x":91, "y":112 } ], - [ { "x":374, "y":163 }, { "x":355, "y":154 }, { "x":343, "y":179 }, { "x":372, "y":167 } ], - [ { "x":355, "y":154 }, { "x":327, "y":103 }, { "x":343, "y":179 } ], - [ { "x":249, "y":352 }, { "x":290, "y":320 }, { "x":199, "y":365 } ], - [ { "x":168, "y":36 }, { "x":134, "y":59 }, { "x":193, "y":33 } ], - [ { "x":276, "y":49 }, { "x":234, "y":34 }, { "x":193, "y":33 }, { "x":310, "y":77 } ], - [ { "x":338, "y":230 }, { "x":343, "y":179 }, { "x":327, "y":103 }, { "x":310, "y":77 }, { "x":314, "y":287 } ] - ] - } - ] - }, - "clumsy3": { - "type": "fromPhysicsEditor", - "label": "clumsy3", - "isStatic": false, - "density": 0.10000000149011612, - "restitution": 0, - "friction": 0.10000000149011612, - "frictionAir": 0.009999999776482582, - "frictionStatic": 0.5, - "collisionFilter": { - "group": 0, - "category": 1, - "mask": 255 - }, - "fixtures": [ - { - "label": "", - "isSensor": false, - "vertices": [ - [ { "x":124, "y":27 }, { "x":134, "y":59 }, { "x":168, "y":36 }, { "x":144, "y":22 } ], - [ { "x":44, "y":364 }, { "x":86, "y":375 }, { "x":132, "y":364 }, { "x":98, "y":100 }, { "x":60, "y":198 }, { "x":37, "y":281 }, { "x":34, "y":321 } ], - [ { "x":174, "y":19 }, { "x":168, "y":36 }, { "x":193, "y":33 }, { "x":182, "y":19 } ], - [ { "x":265, "y":346 }, { "x":314, "y":287 }, { "x":338, "y":230 }, { "x":343, "y":179 }, { "x":193, "y":33 }, { "x":134, "y":59 }, { "x":98, "y":100 }, { "x":193, "y":365 } ], - [ { "x":363, "y":108 }, { "x":327, "y":103 }, { "x":355, "y":154 }, { "x":386, "y":139 }, { "x":384, "y":130 } ], - [ { "x":24, "y":270 }, { "x":37, "y":281 }, { "x":60, "y":198 }, { "x":31, "y":218 }, { "x":20, "y":246 } ], - [ { "x":132, "y":364 }, { "x":193, "y":365 }, { "x":98, "y":100 } ], - [ { "x":374, "y":163 }, { "x":355, "y":154 }, { "x":343, "y":179 }, { "x":372, "y":167 } ], - [ { "x":355, "y":154 }, { "x":327, "y":103 }, { "x":310, "y":77 }, { "x":276, "y":49 }, { "x":234, "y":34 }, { "x":193, "y":33 }, { "x":343, "y":179 } ], - [ { "x":168, "y":36 }, { "x":134, "y":59 }, { "x":193, "y":33 } ] - ] - } - ] - } -} diff --git a/games/game-flipbird/scenes/flipbird/startScene.js b/games/game-flipbird/scenes/flipbird/startScene.js deleted file mode 100644 index c043e65..0000000 --- a/games/game-flipbird/scenes/flipbird/startScene.js +++ /dev/null @@ -1,52 +0,0 @@ -import { Scene } from "phaser"; -import bg from "@/game/game/assets/flipbird/bg.png"; - -import birdImg from "@/game/game/assets/flipbird/clumsy.png"; -import startBtn from "@/game/game/assets/flipbird/start.png"; - -export default class startScene extends Scene { - constructor() { - super({ key: "startFlipBird" }); - } - - preload() { - this.load.image("bg", bg); - this.load.image("startBtn", startBtn); - this.load.spritesheet("bird", birdImg, { - frameWidth: 85, - frameHeight: 60 - }); - } - - create() { - this.bg = this.add.image(0, 0, "bg"); - this.startBtn = this.add.image( - this.game.config.width / 2, - this.game.config.height / 2 + 100, - "startBtn" - ); - this.startBtn.setScale(0.5); - this.bg.setScale(3.1); - this.bird = this.physics.add.sprite( - this.game.config.width / 2, - this.game.config.height / 2, - "bird" - ); - // this.tip = this.add.text( - // this.game.config.width / 2, - // this.game.config.height / 2 - 100, - // "点击屏幕开始游戏", - // { - // fontFamily: 'Georgia, "Goudy Bookletter 1911", Times, serif', - // fontSize: "30px", - // color: "#000", - // align: "center" - // } - // ); - this.startBtn.setInteractive(); - this.startBtn.on("pointerdown", () =>{ - this.scene.start("flipbird"); - }); - } - -} diff --git a/games/game-flood-fill/assets/flood/atari-smooth.png b/games/game-flood-fill/assets/flood/atari-smooth.png new file mode 100644 index 0000000..1988760 Binary files /dev/null and b/games/game-flood-fill/assets/flood/atari-smooth.png differ diff --git a/games/game-flood-fill/assets/flood/blobs.png b/games/game-flood-fill/assets/flood/blobs.png new file mode 100644 index 0000000..c4e7579 Binary files /dev/null and b/games/game-flood-fill/assets/flood/blobs.png differ diff --git a/games/game-flood-fill/assets/flood/monsters.json b/games/game-flood-fill/assets/flood/monsters.json new file mode 100644 index 0000000..43fb28c --- /dev/null +++ b/games/game-flood-fill/assets/flood/monsters.json @@ -0,0 +1,66 @@ +{"frames": [ + +{ + "filename": "blue", + "frame": {"x":3,"y":54,"w":48,"h":48}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":48}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "green", + "frame": {"x":55,"y":54,"w":46,"h":48}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":1,"y":0,"w":46,"h":48}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "orange", + "frame": {"x":3,"y":106,"w":48,"h":48}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":48}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "purple", + "frame": {"x":3,"y":3,"w":48,"h":47}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":47}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "red", + "frame": {"x":55,"y":3,"w":48,"h":47}, + "rotated": false, + "trimmed": true, + "spriteSourceSize": {"x":0,"y":1,"w":48,"h":47}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "yellow", + "frame": {"x":55,"y":106,"w":48,"h":48}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":48,"h":48}, + "sourceSize": {"w":48,"h":48}, + "pivot": {"x":0.5,"y":0.5} +}], +"meta": { + "app": "http://www.codeandweb.com/texturepacker", + "version": "1.0", + "image": "monsters.png", + "format": "RGBA8888", + "size": {"w":106,"h":157}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:94e3861bf3fe5715f53df58e8450923c:2f5153e78b443078a8763ede8bf48b11:8fc4d3ec51ba7bc700054b5f64cf62b1$" +} +} diff --git a/games/game-flood-fill/assets/flood/monsters.png b/games/game-flood-fill/assets/flood/monsters.png new file mode 100644 index 0000000..6f883ea Binary files /dev/null and b/games/game-flood-fill/assets/flood/monsters.png differ diff --git a/games/game-flood-fill/assets/parallax-mountain800600.png b/games/game-flood-fill/assets/parallax-mountain800600.png new file mode 100644 index 0000000..21b0251 Binary files /dev/null and b/games/game-flood-fill/assets/parallax-mountain800600.png differ diff --git a/games/game-flood-fill/constant/index.js b/games/game-flood-fill/constant/index.js new file mode 100644 index 0000000..d4dc253 --- /dev/null +++ b/games/game-flood-fill/constant/index.js @@ -0,0 +1,3 @@ +export const BREAKOUT_JSON = { + +}; diff --git a/games/game-flood-fill/game.js b/games/game-flood-fill/game.js new file mode 100644 index 0000000..0516e78 --- /dev/null +++ b/games/game-flood-fill/game.js @@ -0,0 +1,29 @@ +import Phaser from "phaser"; +import BootScene from "./scenes/BootScene"; +import PlayScene from "./scenes/PlayScene"; +//import { * } from "./constant"; + +function launch(containerId) { + const container = document.getElementById(containerId); + const width = container.clientWidth; + const height = container.clientHeight; + return new Phaser.Game({ + type: Phaser.WEBGL, + width, + height, + parent: containerId, + backgroundColor: 0xbbada0, + pixelArt: true, + physics: { + default: "arcade", + arcade: { + //gravity: { y: 300 }, + debug: true, + }, + }, + scene: [BootScene, PlayScene], + }); +} + +export default launch; +export { launch }; diff --git a/games/game-flipbird/scenes/BootScene.js b/games/game-flood-fill/scenes/BootScene.js similarity index 65% rename from games/game-flipbird/scenes/BootScene.js rename to games/game-flood-fill/scenes/BootScene.js index d6f87f3..7ebc468 100644 --- a/games/game-flipbird/scenes/BootScene.js +++ b/games/game-flood-fill/scenes/BootScene.js @@ -4,14 +4,9 @@ export default class BootScene extends Scene { constructor() { super({ key: "BootScene" }); } - - preload() { - - } + preload() {} create() { - //打开flipbird - this.scene.start("startFlipBird"); - + this.scene.start("PlayScene"); } } diff --git a/games/game-flood-fill/scenes/PlayScene.js b/games/game-flood-fill/scenes/PlayScene.js new file mode 100644 index 0000000..96e2b26 --- /dev/null +++ b/games/game-flood-fill/scenes/PlayScene.js @@ -0,0 +1,744 @@ +import Phaser from "phaser"; +import bg from "@/game/game-breakout/assets/parallax-mountain800600.png"; +import atari from "@/game/game-flood-fill/assets/flood/atari-smooth.png"; +//import atarixml from "@/game/game-flood-fill/assets/flood/atari-smooth.xml"; +import blobs from "@/game/game-flood-fill/assets/flood/blobs.png"; +//import blobsjson from "@/game/game-flood-fill/assets/flood/blobs.json"; + +class PlayScene extends Phaser.Scene { + constructor() { + super({ + key: "PlayScene", + }); + this.allowClick = true; + + this.arrow; + this.cursor; + this.cursorTween; + this.monsterTween; + + this.icon1 = { shadow: null, monster: null }; + this.icon2 = { shadow: null, monster: null }; + this.icon3 = { shadow: null, monster: null }; + this.icon4 = { shadow: null, monster: null }; + this.icon5 = { shadow: null, monster: null }; + this.icon6 = { shadow: null, monster: null }; + + this.gridBG; + + this.instructions; + this.text1; + this.text2; + this.text3; + + this.currentColor = ""; + + this.emitters = {}; + + this.grid = []; + this.matched = []; + + this.moves = 25; + + this.frames = ["blue", "green", "grey", "purple", "red", "yellow"]; + } + + preload() { + this.load.bitmapFont( + "atari", + atari, + "static/assets/flood-fill/atari-smooth.xml" + ); + this.load.atlas("flood", blobs, "static/assets/flood-fill/blobs.json"); + } + + create() { + this.add.image(400, 300, "flood", "background"); + this.gridBG = this.add.image(400, 600 + 300, "flood", "grid"); + + this.createIcon(this.icon1, "grey", 16, 156); + this.createIcon(this.icon2, "red", 16, 312); + this.createIcon(this.icon3, "green", 16, 458); + this.createIcon(this.icon4, "yellow", 688, 156); + this.createIcon(this.icon5, "blue", 688, 312); + this.createIcon(this.icon6, "purple", 688, 458); + + this.cursor = this.add + .image(16, 156, "flood", "cursor-over") + .setOrigin(0) + .setVisible(false); + + // The game is played in a 14x14 grid with 6 different colors + + this.grid = []; + + for (var x = 0; x < 14; x++) { + this.grid[x] = []; + + for (var y = 0; y < 14; y++) { + var sx = 166 + x * 36; + var sy = 66 + y * 36; + var color = Phaser.Math.Between(0, 5); + + var block = this.add.image(sx, -600 + sy, "flood", this.frames[color]); + + block.setData("oldColor", color); + block.setData("color", color); + block.setData("x", sx); + block.setData("y", sy); + + this.grid[x][y] = block; + } + } + + // Do a few floods just to make it a little easier starting off + this.helpFlood(); + + for (var i = 0; i < this.matched.length; i++) { + var blockk = this.matched[i]; + + blockk.setFrame(this.frames[blockk.getData("color")]); + } + + this.currentColor = this.grid[0][0].getData("color"); + + this.particles = this.add.particles("flood"); + + for (var i = 0; i < this.frames.length; i++) { + this.createEmitter(this.frames[i]); + } + + this.createArrow(); + + this.text1 = this.add.bitmapText(684, 30, "atari", "Moves", 20).setAlpha(0); + this.text2 = this.add.bitmapText(694, 60, "atari", "00", 40).setAlpha(0); + this.text3 = this.add + .bitmapText(180, 200, "atari", "So close!\n\nClick to\ntry again", 48) + .setAlpha(0); + + this.instructions = this.add + .image(400, 300, "flood", "instructions") + .setAlpha(0); + //初始化位置 + this.revealGrid(); + } + + update() {} + + helpFlood() { + for (var i = 0; i < 8; i++) { + var x = Phaser.Math.Between(0, 13); + var y = Phaser.Math.Between(0, 13); + + var oldColor = this.grid[x][y].getData("color"); + var newColor = oldColor + 1; + + if (newColor === 6) { + newColor = 0; + } + + this.floodFill(oldColor, newColor, x, y); + } + } + + createArrow() { + this.arrow = this.add + .image(109 - 24, 48, "flood", "arrow-white") + .setOrigin(0) + .setAlpha(0); + + this.tweens.add({ + targets: this.arrow, + x: "+=24", + ease: "Sine.easeInOut", + duration: 900, + yoyo: true, + repeat: -1, + }); + } + + createIcon(icon, color, x, y) { + var sx = x < 400 ? -200 : 1000; + + icon.monster = this.add.image(sx, y, "flood", "icon-" + color).setOrigin(0); + + var shadow = this.add.image(sx, y, "flood", "shadow"); + + shadow.setData("color", this.frames.indexOf(color)); + + shadow.setData("x", x); + + shadow.setData("monster", icon.monster); + + shadow.setOrigin(0); + + shadow.setInteractive(); + + icon.shadow = shadow; + } + + revealGrid() { + this.tweens.add({ + targets: this.gridBG, + y: 300, + ease: "Power3", + }); + + var i = 500; + + for (var y = 13; y >= 0; y--) { + for (var x = 0; x < 14; x++) { + var block = this.grid[x][y]; + + this.tweens.add({ + targets: block, + + y: block.getData("y"), + + ease: "Power3", + duration: 500, + delay: i, + }); + + i += 20; + } + } + + i -= 1000; + + // Icons + this.tweens.add({ + targets: [this.icon1.shadow, this.icon1.monster], + x: this.icon1.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + this.tweens.add({ + targets: [this.icon4.shadow, this.icon4.monster], + x: this.icon4.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + i += 200; + + this.tweens.add({ + targets: [this.icon2.shadow, this.icon2.monster], + x: this.icon2.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + this.tweens.add({ + targets: [this.icon5.shadow, this.icon5.monster], + x: this.icon5.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + i += 200; + + this.tweens.add({ + targets: [this.icon3.shadow, this.icon3.monster], + x: this.icon3.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + this.tweens.add({ + targets: [this.icon6.shadow, this.icon6.monster], + x: this.icon6.shadow.getData("x"), + ease: "Power3", + delay: i, + }); + + // Text + + this.tweens.add({ + targets: [this.text1, this.text2], + alpha: 1, + ease: "Power3", + delay: i, + }); + + i += 500; + + var movesTween = this.tweens.addCounter({ + from: 0, + to: 25, + ease: "Power1", + onUpdate: function(tween, targets, text) { + text.setText( + Phaser.Utils.String.Pad(tween.getValue().toFixed(), 2, "0", 1) + ); + }, + onUpdateParams: [this.text2], + delay: i, + }); + + i += 500; + + this.tweens.add({ + targets: [this.instructions, this.arrow], + alpha: 1, + ease: "Power3", + delay: i, + }); + + this.time.delayedCall(i, this.startInputEvents, [], this); + } + + startInputEvents() { + this.input.on("gameobjectover", this.onIconOver, this); + this.input.on("gameobjectout", this.onIconOut, this); + this.input.on("gameobjectdown", this.onIconDown, this); + + // Cheat mode :) + + this.input.keyboard.on( + "keydown_M", + function() { + this.moves++; + this.text2.setText(Phaser.Utils.String.Pad(this.moves, 2, "0", 1)); + }, + this + ); + + this.input.keyboard.on( + "keydown_X", + function() { + this.moves--; + this.text2.setText(Phaser.Utils.String.Pad(this.moves, 2, "0", 1)); + }, + this + ); + } + + stopInputEvents() { + this.input.off("gameobjectover", this.onIconOver); + this.input.off("gameobjectout", this.onIconOut); + this.input.off("gameobjectdown", this.onIconDown); + } + + onIconOver(pointer, gameObject) { + var icon = gameObject; + + var newColor = icon.getData("color"); + + // Valid color? + if (newColor !== this.currentColor) { + this.cursor.setFrame("cursor-over"); + } else { + this.cursor.setFrame("cursor-invalid"); + } + + this.cursor.setPosition(icon.x + icon.width / 2, icon.y + icon.height / 2); + if (this.cursorTween) { + this.cursorTween.stop(); + } + + this.cursor.setAlpha(1); + this.cursor.setVisible(true); + + // Change arrow color + this.arrow.setFrame("arrow-" + this.frames[newColor]); + + // Jiggle the monster :) + var monster = icon.getData("monster"); + + this.children.bringToTop(monster); + + this.monsterTween = this.tweens.add({ + targets: monster, + y: "-=24", + yoyo: true, + repeat: -1, + duration: 300, + ease: "Power2", + }); + } + + onIconOut(pointer, gameObject) { + // console.log(this.monsterTween.targets[0].y); + + this.monsterTween.stop(0); + + gameObject.getData("monster").setY(gameObject.y); + + // console.log(this.monsterTween.targets[0].y); + + this.cursorTween = this.tweens.add({ + targets: this.cursor, + alpha: 0, + duration: 300, + }); + + this.arrow.setFrame("arrow-white"); + } + + onIconDown(pointer, gameObject) { + if (!this.allowClick) { + return; + } + + var icon = gameObject; + + var newColor = icon.getData("color"); + + // Valid color? + if (newColor === this.currentColor) { + return; + } + + var oldColor = this.grid[0][0].getData("color"); + + // console.log('starting flood from', oldColor, this.frames[oldColor], 'to', newColor, this.frames[newColor]); + + if (oldColor !== newColor) { + this.currentColor = newColor; + + this.matched = []; + + if (this.monsterTween) { + this.monsterTween.stop(0); + } + + this.cursor.setVisible(false); + this.instructions.setVisible(false); + + this.moves--; + + this.text2.setText(Phaser.Utils.String.Pad(this.moves, 2, "0", 1)); + + this.floodFill(oldColor, newColor, 0, 0); + + if (this.matched.length > 0) { + this.startFlow(); + } + } + } + + createEmitter(color) { + this.emitters[color] = this.particles.createEmitter({ + frame: color, + lifespan: 1000, + speed: { min: 300, max: 400 }, + alpha: { start: 1, end: 0 }, + scale: { start: 0.5, end: 0 }, + rotate: { start: 0, end: 360, ease: "Power2" }, + blendMode: "ADD", + on: false, + }); + } + + startFlow() { + this.matched.sort(function(a, b) { + var aDistance = Phaser.Math.Distance.Between(a.x, a.y, 166, 66); + var bDistance = Phaser.Math.Distance.Between(b.x, b.y, 166, 66); + + return aDistance - bDistance; + }); + + // Swap the sprites + + var t = 0; + var inc = this.matched.length > 98 ? 6 : 12; + + this.allowClick = false; + + for (var i = 0; i < this.matched.length; i++) { + var block = this.matched[i]; + + var blockColor = this.frames[block.getData("color")]; + var oldBlockColor = this.frames[block.getData("oldColor")]; + + var emitter = this.emitters[oldBlockColor]; + + this.time.delayedCall( + t, + function(block, blockColor) { + block.setFrame(blockColor); + + emitter.explode(6, block.x, block.y); + }, + [block, blockColor, emitter] + ); + + t += inc; + } + + this.time.delayedCall( + t, + function() { + this.allowClick = true; + + if (this.checkWon()) { + this.gameWon(); + } else if (this.moves === 0) { + this.gameLost(); + } + }, + [], + this + ); + } + + checkWon() { + var topLeft = this.grid[0][0].getData("color"); + + for (var x = 0; x < 14; x++) { + for (var y = 0; y < 14; y++) { + if (this.grid[x][y].getData("color") !== topLeft) { + return false; + } + } + } + + return true; + } + + clearGrid() { + // Hide everything :) + + this.tweens.add({ + targets: [ + this.icon1.monster, + this.icon1.shadow, + this.icon2.monster, + this.icon2.shadow, + this.icon3.monster, + this.icon3.shadow, + this.icon4.monster, + this.icon4.shadow, + this.icon5.monster, + this.icon5.shadow, + this.icon6.monster, + this.icon6.shadow, + this.arrow, + this.cursor, + ], + alpha: 0, + duration: 500, + delay: 500, + }); + + var i = 500; + + for (var y = 13; y >= 0; y--) { + for (var x = 0; x < 14; x++) { + var block = this.grid[x][y]; + + this.tweens.add({ + targets: block, + + scaleX: 0, + scaleY: 0, + + ease: "Power3", + duration: 800, + delay: i, + }); + + i += 10; + } + } + + return i; + } + + gameLost() { + this.stopInputEvents(); + + this.text1.setText("Lost!"); + this.text2.setText(":("); + + var i = this.clearGrid(); + + this.text3.setAlpha(0); + this.text3.setVisible(true); + + this.tweens.add({ + targets: this.text3, + alpha: 1, + duration: 1000, + delay: i, + }); + + this.input.once("pointerdown", this.resetGame, this); + } + + resetGame() { + this.text1.setText("Moves"); + this.text2.setText("00"); + this.text3.setVisible(false); + + // Show everything :) + + this.arrow.setFrame("arrow-white"); + + this.tweens.add({ + targets: [ + this.icon1.monster, + this.icon1.shadow, + this.icon2.monster, + this.icon2.shadow, + this.icon3.monster, + this.icon3.shadow, + this.icon4.monster, + this.icon4.shadow, + this.icon5.monster, + this.icon5.shadow, + this.icon6.monster, + this.icon6.shadow, + this.arrow, + this.cursor, + ], + alpha: 1, + duration: 500, + delay: 500, + }); + + var i = 500; + + for (var y = 13; y >= 0; y--) { + for (var x = 0; x < 14; x++) { + var block = this.grid[x][y]; + + // Set a new color + var color = Phaser.Math.Between(0, 5); + + block.setFrame(this.frames[color]); + + block.setData("oldColor", color); + block.setData("color", color); + + this.tweens.add({ + targets: block, + + scaleX: 1, + scaleY: 1, + + ease: "Power3", + duration: 800, + delay: i, + }); + + i += 10; + } + } + + // Do a few floods just to make it a little easier starting off + this.helpFlood(); + + for (var i = 0; i < this.matched.length; i++) { + var block = this.matched[i]; + + block.setFrame(this.frames[block.getData("color")]); + } + + this.currentColor = this.grid[0][0].getData("color"); + + var movesTween = this.tweens.addCounter({ + from: 0, + to: 25, + ease: "Power1", + onUpdate: function(tween, targets, text) { + text.setText( + Phaser.Utils.String.Pad(tween.getValue().toFixed(), 2, "0", 1) + ); + }, + onUpdateParams: [this.text2], + delay: i, + }); + + this.moves = 25; + + this.time.delayedCall(i, this.startInputEvents, [], this); + } + + gameWon() { + this.stopInputEvents(); + + this.text1.setText("Won!!"); + this.text2.setText(":)"); + + var i = this.clearGrid(); + + // Put the winning monster in the middle + + var monster = this.add.image( + 400, + 300, + "flood", + "icon-" + this.frames[this.currentColor] + ); + + monster.setScale(0); + + this.tweens.add({ + targets: monster, + scaleX: 4, + scaleY: 4, + angle: 360 * 4, + duration: 1000, + delay: i, + }); + + this.time.delayedCall(2000, this.boom, [], this); + } + + boom() { + var color = Phaser.Math.RND.pick(this.frames); + + this.emitters[color].explode( + 8, + Phaser.Math.Between(128, 672), + Phaser.Math.Between(28, 572) + ); + + color = Phaser.Math.RND.pick(this.frames); + + this.emitters[color].explode( + 8, + Phaser.Math.Between(128, 672), + Phaser.Math.Between(28, 572) + ); + + this.time.delayedCall(100, this.boom, [], this); + } + //调低难度中间放一些相同颜色的 + floodFill(oldColor, newColor, x, y) { + if ( + oldColor === newColor || + this.grid[x][y].getData("color") !== oldColor + ) { + return; + } + + this.grid[x][y].setData("oldColor", oldColor); + this.grid[x][y].setData("color", newColor); + + if (this.matched.indexOf(this.grid[x][y]) === -1) { + this.matched.push(this.grid[x][y]); + } + + if (x > 0) { + this.floodFill(oldColor, newColor, x - 1, y); + } + + if (x < 13) { + this.floodFill(oldColor, newColor, x + 1, y); + } + + if (y > 0) { + this.floodFill(oldColor, newColor, x, y - 1); + } + + if (y < 13) { + this.floodFill(oldColor, newColor, x, y + 1); + } + } +} + +export default PlayScene; diff --git a/games/game-rect/assets/1.png b/games/game-rect/assets/1.png new file mode 100644 index 0000000..f65aea7 Binary files /dev/null and b/games/game-rect/assets/1.png differ diff --git a/games/game-rect/assets/2.png b/games/game-rect/assets/2.png new file mode 100644 index 0000000..2fa00e4 Binary files /dev/null and b/games/game-rect/assets/2.png differ diff --git a/games/game-rect/assets/3.png b/games/game-rect/assets/3.png new file mode 100644 index 0000000..5ba6f71 Binary files /dev/null and b/games/game-rect/assets/3.png differ diff --git a/games/game-rect/assets/4.png b/games/game-rect/assets/4.png new file mode 100644 index 0000000..778ba19 Binary files /dev/null and b/games/game-rect/assets/4.png differ diff --git a/games/game-rect/assets/5.png b/games/game-rect/assets/5.png new file mode 100644 index 0000000..325faf0 Binary files /dev/null and b/games/game-rect/assets/5.png differ diff --git a/games/game-rect/assets/a.json b/games/game-rect/assets/a.json new file mode 100644 index 0000000..57fd389 --- /dev/null +++ b/games/game-rect/assets/a.json @@ -0,0 +1,125 @@ +{ + "textures": [ + { + "image": "a.png", + "format": "RGBA8888", + "size": { + "w": 535, + "h": 107 + }, + "scale": 1, + "frames": [ + { + "filename": "1.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 105, + "h": 105 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 105, + "h": 105 + }, + "frame": { + "x": 1, + "y": 1, + "w": 105, + "h": 105 + } + }, + { + "filename": "2.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 105, + "h": 105 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 105, + "h": 105 + }, + "frame": { + "x": 108, + "y": 1, + "w": 105, + "h": 105 + } + }, + { + "filename": "3.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 105, + "h": 105 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 105, + "h": 105 + }, + "frame": { + "x": 215, + "y": 1, + "w": 105, + "h": 105 + } + }, + { + "filename": "4.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 105, + "h": 105 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 105, + "h": 105 + }, + "frame": { + "x": 322, + "y": 1, + "w": 105, + "h": 105 + } + }, + { + "filename": "5.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 105, + "h": 105 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 105, + "h": 105 + }, + "frame": { + "x": 429, + "y": 1, + "w": 105, + "h": 105 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:ebd240980a740d94d2fdd16bdeefc610:50d42e55d80513b21b41588cfbb29433:bf9645bc287ef85d0bf835d4803a79ae$" + } +} diff --git a/games/game-rect/assets/a.png b/games/game-rect/assets/a.png new file mode 100644 index 0000000..0e269cd Binary files /dev/null and b/games/game-rect/assets/a.png differ diff --git a/games/game-rect/assets/bg.jpg b/games/game-rect/assets/bg.jpg new file mode 100644 index 0000000..eec54a9 Binary files /dev/null and b/games/game-rect/assets/bg.jpg differ diff --git a/games/game-rect/assets/gridTile.png b/games/game-rect/assets/gridTile.png new file mode 100644 index 0000000..82f003a Binary files /dev/null and b/games/game-rect/assets/gridTile.png differ diff --git a/games/game-rect/assets/tiles.png b/games/game-rect/assets/tiles.png new file mode 100644 index 0000000..ea433fe Binary files /dev/null and b/games/game-rect/assets/tiles.png differ diff --git a/games/game-rect/game.js b/games/game-rect/game.js new file mode 100644 index 0000000..8c6aebd --- /dev/null +++ b/games/game-rect/game.js @@ -0,0 +1,40 @@ +import Phaser from "phaser"; +import Rect from "./scenes/Rect"; + +function launch({ containerId, onLose }) { + const container = document.getElementById(containerId); + const width = container.clientWidth; + const height = container.clientHeight; + + const game = new Phaser.Game({ + type: Phaser.AUTO, + width, + height, + parent: containerId, + physics: { + default: "arcade", + arcade: { + //gravity: { y: 300 }, + debug: false, + }, + }, + scale: { + mode: Phaser.Scale.FIT, + autoCenter: Phaser.Scale.CENTER_BOTH, + parent: containerId, + width: 1080, + height: 1080, + }, + scene: Rect, + }); + Object.assign(game, { + onLose, + restart() { + this.scene.scenes[0].scene.start("Rect"); + }, + }); + return game; +} + +export default launch; +export { launch }; diff --git a/games/game-rect/scenes/Rect.js b/games/game-rect/scenes/Rect.js new file mode 100644 index 0000000..d41925e --- /dev/null +++ b/games/game-rect/scenes/Rect.js @@ -0,0 +1,297 @@ +import Phaser from "phaser"; +import tiles from "../assets/a.png"; +import bg from "../assets/bg.jpg"; +import gridTile from "../assets/gridTile.png"; +/** + *博客 + * https://www.emanueleferonato.com/2020/04/17/html5-prototype-of-bricks-hyper-casual-game-with-phaser-and-arcade-physics-step-2-adding-score/ + */ +const gameWidth = 927; +const tileSpace = 3; +const offsetLeft = (1080 - gameWidth) / 2; +export default class Rect extends Phaser.Scene { + constructor() { + super({ key: "Rect" }); + this.gameOptions = { + // number of columns + columns: 9, + + // number of rows, must be high enough to allow object pooling + rows: 20, + + // tile speed in pixels per second + tileSpeed: 100, + }; + } + preload() { + this.load.image("bg", bg); + this.load.image("gridTile", gridTile); + this.load.spritesheet("tiles", tiles, { + frameWidth: 107, + frameHeight: 107, + }); + } + create() { + this.bg = this.add.image( + this.game.config.width / 2, + this.game.config.height / 2, + "bg" + ); + this.bg.displayWidth = this.game.config.width; + this.bg.displayHeight = this.game.config.height; + // physics group which manages all tiles in game + this.tileGroup = this.physics.add.group(); + + // determining tile size according to game width and columns + this.tileSize = + (gameWidth - tileSpace * (this.gameOptions.columns - 1)) / + this.gameOptions.columns; + + // time to add tiles to the game + for (let i = 0; i < this.gameOptions.rows; i++) { + // build an array with integers between 0 and this.gameOptions.columns - 1: [0, 1, 2, ..., this.gameOptions.columns - 1] + let values = Phaser.Utils.Array.NumberArray( + 0, + this.gameOptions.columns - 1 + ); + + // then we shuffle the array + Phaser.Utils.Array.Shuffle(values); + + // save middle column color of first row + if (i == 0) { + var middleColor = values[Math.floor(this.gameOptions.columns / 2)]; + } + + // now we place the tiles, row by row + for (let j = 0; j < this.gameOptions.columns; j++) { + // add a tile. Tile frame is set according to "values" shuffled array + let tile = this.tileGroup.create( + offsetLeft + j * this.tileSize, + i * this.tileSize + (this.game.config.height / 4) * 3, + "tiles", + values[j] + ); + + // call adjustTile method to adjust tile origin and display size + this.adjustTile(tile); + } + } + + // let's build once again an array with integers between 0 and this.gameOptions.columns - 1 + let values = Phaser.Utils.Array.NumberArray( + 0, + this.gameOptions.columns - 1 + ); + + // remove the item at "middlecolor" position because we don't want it to be randomly selected + values.splice(middleColor, 1); + + // add the player to the this.this.game. Player color is picked amoung "values" array items, which does not contain anymore "middlecolor" value + this.player = this.tileGroup.create( + offsetLeft + this.tileSize * Math.floor(this.gameOptions.columns / 2), + (this.game.config.height / 4) * 3 - this.tileSize, + "tiles", + Phaser.Utils.Array.GetRandom(values) + ); + + // adjust player origin and display size + this.adjustTile(this.player); + + // the score + this.score = 0; + + // add score text + this.scoreText = this.add.text(0, 0, "0", { + fontFamily: "Arial Black", + fontSize: this.tileSize / 3, + color: "#ffffff", + }); + + // set a stroke to score text + this.scoreText.setStroke("#000000", this.tileSize / 6); + + // method to adjust score position + this.adjustScorePosition(); + + // move entire tile group up by this.gameOptions.tileSpeed pixels / second + this.tileGroup.setVelocityY(-this.gameOptions.tileSpeed); + + // can the player move? Yes, at the moment + this.canMove = true; + + // did we match any tile? No, at the moment + this.matched = false; + + // wait for player input + this.input.off("pointerdown"); + this.input.on("pointerdown", this.moveTile, this); + } + // method to be executed at each frame + update() { + // if the player touches the top of the screen... + if (this.player.y < 200) { + // gmae over man, restart the this.game + //this.scene.start("Rect"); + //this.scene.stop + this.tileGroup.setVelocityY(0); + this.input.off("pointerdown"); + this.input.on( + "pointerdown", + function () { + this.scene.start("Rect"); + }, + this + ); + } else { + // we need to adjust score position at each frame + this.adjustScorePosition(); + } + } + // method to set tile origin and display size + adjustTile(sprite) { + // set origin at the top left corner + sprite.setOrigin(0); + + // set display width and height to "tileSize" pixels + sprite.displayWidth = this.tileSize; + sprite.displayHeight = this.tileSize; + } + + // method to adjust score position + adjustScorePosition() { + // adjust score position according to its bounding box and player position + this.scoreText.x = + this.player.x + (this.tileSize - this.scoreText.getBounds().width) / 2; + this.scoreText.y = + this.player.y + (this.tileSize - this.scoreText.getBounds().height) / 2; + } + + // method to move player tile + moveTile(pointer) { + // if we can move... + if (this.canMove) { + // determine column according to input coordinate and tile size + let column = Math.floor((pointer.x - offsetLeft) / this.tileSize); + + // get the ditance from current player tile and destination + let distance = Math.floor( + Math.abs(column * this.tileSize - this.player.x) / this.tileSize + ); + + // did we actually move? + if (distance > 0) { + // we can't move anymore + this.canMove = false; + + // tween the player to destination tile + this.tweens.add({ + targets: [this.player], + x: offsetLeft + column * this.tileSize, + duration: distance * 30, + callbackScope: this, + onComplete: function () { + // at the end of the tween, check for tile match + this.checkMatch(); + }, + }); + } + } + } + + // method to check tile matches + checkMatch() { + // get tile below player tile + let tileBelow = this.physics.overlapRect( + this.player.x + this.tileSize / 2, + this.player.y + this.tileSize * 1.5, + 1, + 1 + ); + + // "tileBelow" is an array so we have to compare the first - and only - item frame with player frame. Are the two frames the same? + if (tileBelow[0].gameObject.frame.name == this.player.frame.name) { + // we have a match + this.matched = true; + + // check the whole row below player tile + let rowBelow = this.physics.overlapRect( + 0, + this.player.y + this.tileSize * 1.5, + gameWidth, + 1 + ); + + // tween down the player + this.tweens.add({ + targets: [this.player], + y: tileBelow[0].gameObject.y, + duration: 100, + callbackScope: this, + onUpdate: function (tween, target) { + // at each update, we have to adjust player position because tiles continue moving up + this.player.y = Math.min(this.player.y, tileBelow[0].gameObject.y); + }, + + // at the end of the tween, we have to move the row at the bottom, to reuse sprites + onComplete: function () { + // increment score + this.score++; + + // update score text + this.scoreText.setText(this.score); + + // the good old array with all integers from zero to this.gameOptions.columns - 1 + let values = Phaser.Utils.Array.NumberArray( + 0, + this.gameOptions.columns - 1 + ); + + // let's shuffle the array + Phaser.Utils.Array.Shuffle(values); + + // place all tiles below the lowest row + for (let i = 0; i < this.gameOptions.columns; i++) { + rowBelow[i].gameObject.setFrame(values[i]); + rowBelow[i].gameObject.y += this.tileSize * this.gameOptions.rows; + } + + // check for matches again, there could be a combo + this.checkMatch(); + }, + }); + } + + // what to do when player moved but there isn't any match? + else { + // we can move again + this.canMove = true; + + // is there a previous match? Did we come here from a previous match? + if (this.matched) { + // no more matches + this.matched = false; + + // get the tile below the player + let tileBelow = this.physics.overlapRect( + this.player.x + this.tileSize / 2, + this.player.y + this.tileSize * 1.5, + 1, + 1 + ); + + // the good old array with all integers from zero to this.gameOptions.columns - 1 + let values = Phaser.Utils.Array.NumberArray( + 0, + this.gameOptions.columns - 1 + ); + + // remove the item at "frame" value of tile below the player pbecause we don't want it to be randomly selected + values.splice(tileBelow[0].gameObject.frame.name, 1); + + // change player frame + this.player.setFrame(Phaser.Utils.Array.GetRandom(values)); + } + } + } +} diff --git a/games/game2048/assets/sprites/1024.png b/games/game2048/assets/sprites/1024.png new file mode 100644 index 0000000..956e0f7 Binary files /dev/null and b/games/game2048/assets/sprites/1024.png differ diff --git a/games/game2048/assets/sprites/128.png b/games/game2048/assets/sprites/128.png new file mode 100644 index 0000000..e31e1ae Binary files /dev/null and b/games/game2048/assets/sprites/128.png differ diff --git a/games/game2048/assets/sprites/16.png b/games/game2048/assets/sprites/16.png new file mode 100644 index 0000000..3ba95b4 Binary files /dev/null and b/games/game2048/assets/sprites/16.png differ diff --git a/games/game2048/assets/sprites/2.png b/games/game2048/assets/sprites/2.png new file mode 100644 index 0000000..28288bc Binary files /dev/null and b/games/game2048/assets/sprites/2.png differ diff --git a/games/game2048/assets/sprites/2048.png b/games/game2048/assets/sprites/2048.png new file mode 100644 index 0000000..178246a Binary files /dev/null and b/games/game2048/assets/sprites/2048.png differ diff --git a/games/game2048/assets/sprites/256.png b/games/game2048/assets/sprites/256.png new file mode 100644 index 0000000..f0a651a Binary files /dev/null and b/games/game2048/assets/sprites/256.png differ diff --git a/games/game2048/assets/sprites/32.png b/games/game2048/assets/sprites/32.png new file mode 100644 index 0000000..6ec914d Binary files /dev/null and b/games/game2048/assets/sprites/32.png differ diff --git a/games/game2048/assets/sprites/4.png b/games/game2048/assets/sprites/4.png new file mode 100644 index 0000000..db814c5 Binary files /dev/null and b/games/game2048/assets/sprites/4.png differ diff --git a/games/game2048/assets/sprites/4096.png b/games/game2048/assets/sprites/4096.png new file mode 100644 index 0000000..ad92357 Binary files /dev/null and b/games/game2048/assets/sprites/4096.png differ diff --git a/games/game2048/assets/sprites/512.png b/games/game2048/assets/sprites/512.png new file mode 100644 index 0000000..8a08a55 Binary files /dev/null and b/games/game2048/assets/sprites/512.png differ diff --git a/games/game2048/assets/sprites/64.png b/games/game2048/assets/sprites/64.png new file mode 100644 index 0000000..d3e48bb Binary files /dev/null and b/games/game2048/assets/sprites/64.png differ diff --git a/games/game2048/assets/sprites/8.png b/games/game2048/assets/sprites/8.png new file mode 100644 index 0000000..02d3a0f Binary files /dev/null and b/games/game2048/assets/sprites/8.png differ diff --git a/games/game2048/assets/sprites/tile_default.png b/games/game2048/assets/sprites/tile_default.png index f1fc979..0e38399 100644 Binary files a/games/game2048/assets/sprites/tile_default.png and b/games/game2048/assets/sprites/tile_default.png differ diff --git a/games/game2048/assets/sprites/tiles.json b/games/game2048/assets/sprites/tiles.json new file mode 100644 index 0000000..63e650d --- /dev/null +++ b/games/game2048/assets/sprites/tiles.json @@ -0,0 +1,272 @@ +{ + "textures": [ + { + "image": "tiles.png", + "format": "RGBA8888", + "size": { + "w": 1032, + "h": 344 + }, + "scale": 1, + "frames": [ + { + "filename": "1024.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 1, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "128.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 1, + "y": 173, + "w": 170, + "h": 170 + } + }, + { + "filename": "16.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 173, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "2.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 173, + "y": 173, + "w": 170, + "h": 170 + } + }, + { + "filename": "2048.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 345, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "256.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 345, + "y": 173, + "w": 170, + "h": 170 + } + }, + { + "filename": "32.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 517, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "4.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 517, + "y": 173, + "w": 170, + "h": 170 + } + }, + { + "filename": "4096.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 689, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "512.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 689, + "y": 173, + "w": 170, + "h": 170 + } + }, + { + "filename": "64.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 861, + "y": 1, + "w": 170, + "h": 170 + } + }, + { + "filename": "8.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 170, + "h": 170 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 170, + "h": 170 + }, + "frame": { + "x": 861, + "y": 173, + "w": 170, + "h": 170 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:1decd60200dc4068e266e6923d085e4b:41886a3440c847ce1263cc40cb4306a2:accbe1e7e294ded8391337fc1c446319$" + } +} diff --git a/games/game2048/assets/sprites/tiles.png b/games/game2048/assets/sprites/tiles.png new file mode 100644 index 0000000..3e47a07 Binary files /dev/null and b/games/game2048/assets/sprites/tiles.png differ diff --git a/games/game2048/constant/index.js b/games/game2048/constant/index.js index 0ecd677..b5326e4 100644 --- a/games/game2048/constant/index.js +++ b/games/game2048/constant/index.js @@ -2,6 +2,6 @@ export const ROW = 1; //0 export const COL = 2; const gameArea = 740; export const TILE_SPACING = 10; //8 -export const TILE_SIZE = (gameArea - TILE_SPACING * 3) / 4; //80 +export const TILE_SIZE = (gameArea - TILE_SPACING * 5) / 4; //80 export const TWEEN_DURATION = 100; diff --git a/games/game2048/game.js b/games/game2048/game.js index 98dd3b5..e9d7689 100644 --- a/games/game2048/game.js +++ b/games/game2048/game.js @@ -1,6 +1,5 @@ import Phaser from "phaser"; import PlayScene from "./scenes/PlayScene"; -import { TILE_SIZE, TILE_SPACING } from "./constant"; function launch({ containerId, onLose }) { const container = document.getElementById(containerId); diff --git a/games/game2048/scenes/PlayScene.js b/games/game2048/scenes/PlayScene.js index 0ae0e5d..22181d4 100644 --- a/games/game2048/scenes/PlayScene.js +++ b/games/game2048/scenes/PlayScene.js @@ -1,7 +1,7 @@ import Phaser from "phaser"; import tile_default from "../assets/sprites/tile_default.png"; -import tiles from "../assets/sprites/tiles2x.png"; +import tiles from "../assets/sprites/tiles.png"; import bg from "../assets/sprites/bg.jpg"; // import move_mp3 from "../assets/sounds/move.mp3"; @@ -10,7 +10,20 @@ import bg from "../assets/sprites/bg.jpg"; // import grow_ogg from "../assets/sounds/grow.ogg"; import { COL, ROW, TILE_SIZE, TILE_SPACING, TWEEN_DURATION } from "../constant"; - +const tileMap = { + 0: 7, + 1: 9, + 2: 11, + 3: 1, + 4: 3, + 5: 5, + 6: 6, + 7: 8, + 8: 10, + 9: 0, + 10: 2, + 11: 4, +}; class PlayScene extends Phaser.Scene { tileArray = []; canMove = false; @@ -26,8 +39,8 @@ class PlayScene extends Phaser.Scene { this.load.image("tile_default", tile_default); this.load.image("bg", bg); this.load.spritesheet("tiles", tiles, { - frameWidth: 160, - frameHeight: 160, + frameWidth: 172, + frameHeight: 172, }); // this.load.audio("move", [move_mp3, move_ogg]); @@ -329,7 +342,7 @@ class PlayScene extends Phaser.Scene { transformTile(tile, row, col) { // this.growSound.play(); this.movingTiles++; - tile.tileSprite.setFrame(this.tileArray[row][col].tileValue - 1); + tile.tileSprite.setFrame(tileMap[this.tileArray[row][col].tileValue - 1]); this.tweens.add({ targets: [tile.tileSprite], scaleX: 1.1, @@ -361,7 +374,7 @@ class PlayScene extends Phaser.Scene { // 假如 tileValue = 2,则方块数值为 Math.pow(2,2) == 4, 4 的精灵索引为1,所以等于 tileValue - 1 this.tileArray[i][j].tileSprite.setFrame( - this.tileArray[i][j].tileValue - 1 + tileMap[this.tileArray[i][j].tileValue - 1] ); } else { this.tileArray[i][j].tileSprite.alpha = 0; @@ -433,7 +446,10 @@ class PlayScene extends Phaser.Scene { setPosition(pos, direction) { let top = direction === ROW ? 270 : 160; return ( - pos * (TILE_SIZE + TILE_SPACING) + TILE_SIZE * 0.5 + TILE_SPACING + top + pos * (TILE_SIZE + TILE_SPACING) + + TILE_SIZE * 0.5 + + TILE_SPACING * 2 + + top ); } //添加随机的2 @@ -454,7 +470,9 @@ class PlayScene extends Phaser.Scene { let chosenTile = Phaser.Utils.Array.GetRandom(emptyTiles); this.tileArray[chosenTile.row][chosenTile.col].tileValue = 1; this.tileArray[chosenTile.row][chosenTile.col].tileSprite.visible = true; - this.tileArray[chosenTile.row][chosenTile.col].tileSprite.setFrame(0); + this.tileArray[chosenTile.row][chosenTile.col].tileSprite.setFrame( + tileMap[0] + ); this.tweens.add({ targets: [this.tileArray[chosenTile.row][chosenTile.col].tileSprite],