{"ScriptPreparationCode":"var current = 0;\r\nvar speed = 1;\r\nvar pacman = {\r\n\tbody: {\r\n \tvelocity: {\r\n \tx: 0,\r\n \ty: 0,\r\n }\r\n },\r\n \tscale: {\r\n \tx: 1,\r\n },\r\n \tangle: 0,\r\n};\r\nvar direction = 0;\r\nvar Phaser = {\r\n \u0027LEFT\u0027: 0,\r\n \u0027RIGHT\u0027: 1,\r\n \u0027UP\u0027: 2,\r\n \u0027DOWN\u0027: 3\r\n}\r\n","TestCases":[{"Name":"If","Code":"if (direction === Phaser.LEFT || direction === Phaser.UP) {\r\n speed = -speed;\r\n}\r\n\r\nif (direction === Phaser.LEFT || direction === Phaser.RIGHT) {\r\n pacman.body.velocity.x = speed;\r\n}\r\nelse {\r\n pacman.body.velocity.y = speed;\r\n}\r\n\r\n// Reset the scale and angle (Pacman is facing to the right in the sprite sheet)\r\npacman.scale.x = 1;\r\npacman.angle = 0;\r\n\r\nif (direction === Phaser.LEFT) {\r\n pacman.scale.x = -1;\r\n}\r\nelse if (direction === Phaser.UP) {\r\n pacman.angle = 270;\r\n}\r\nelse if (direction === Phaser.DOWN) {\r\n pacman.angle = 90;\r\n}\r\n\r\ncurrent = direction;","IsDeferred":false},{"Name":"If 2","Code":"// Reset the scale and angle (Pacman is facing to the right in the sprite sheet)\r\npacman.scale.x = 1;\r\npacman.angle = 0;\r\n\r\nif (direction === Phaser.LEFT) {\r\n pacman.body.velocity.x = -speed;\r\n pacman.scale.x = -1;\r\n}\r\nelse if (direction === Phaser.UP) {\r\n pacman.body.velocity.y = -speed;\r\n pacman.angle = 270;\r\n}\r\nelse if (direction === Phaser.DOWN) {\r\n pacman.body.velocity.y = speed;\r\n pacman.angle = 90;\r\n}\r\nelse if (direction === Phaser.RIGHT) {\r\n pacman.body.velocity.x = speed;\r\n}\r\n\r\ncurrent = direction;","IsDeferred":false}]}