{"id":13901377,"url":"https://github.com/ganlvtech/phaser-catch-the-cat","last_synced_at":"2025-04-04T12:07:00.779Z","repository":{"id":38084467,"uuid":"167024556","full_name":"ganlvtech/phaser-catch-the-cat","owner":"ganlvtech","description":"An HTML5 game 'Catch The Cat' powered by Phaser 3","archived":false,"fork":false,"pushed_at":"2022-12-25T14:08:41.000Z","size":850,"stargazers_count":677,"open_issues_count":2,"forks_count":189,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T11:07:40.134Z","etag":null,"topics":["game","javascript","phaser","phaser3","typescript"],"latest_commit_sha":null,"homepage":"https://ganlvtech.github.io/phaser-catch-the-cat/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ganlvtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-22T16:10:53.000Z","updated_at":"2025-03-23T14:36:51.000Z","dependencies_parsed_at":"2023-01-30T22:16:04.454Z","dependency_job_id":null,"html_url":"https://github.com/ganlvtech/phaser-catch-the-cat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganlvtech%2Fphaser-catch-the-cat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganlvtech%2Fphaser-catch-the-cat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganlvtech%2Fphaser-catch-the-cat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganlvtech%2Fphaser-catch-the-cat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganlvtech","download_url":"https://codeload.github.com/ganlvtech/phaser-catch-the-cat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174416,"owners_count":20896078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","javascript","phaser","phaser3","typescript"],"created_at":"2024-08-06T21:01:17.953Z","updated_at":"2025-04-04T12:07:00.752Z","avatar_url":"https://github.com/ganlvtech.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# 捉住小猫\n\n[开始游戏](https://ganlvtech.github.io/phaser-catch-the-cat/)\n[![Build Status](https://www.travis-ci.org/ganlvtech/phaser-catch-the-cat.svg?branch=master)](https://www.travis-ci.org/ganlvtech/phaser-catch-the-cat)\n\n## 游戏玩法\n\n* 点击小圆点，围住小猫。\n* 你点击一次，小猫走一次。\n* 直到你把小猫围住（赢），或者小猫走到边界并逃跑（输）。\n\n## 部署\n\n首先引入游戏框架 `phaser.min.js`\n\n```html\n\u003cscript src=\"phaser.min.js\"\u003e\u003c/script\u003e\n```\n\n然后引入游戏代码 `catch-the-cat.js`\n\n```html\n\u003cscript src=\"catch-the-cat.js\"\u003e\u003c/script\u003e\n```\n\n然后在指定的 div 中新建一个游戏的 canvas，并开始游戏\n\n```html\n\u003cdiv id=\"catch-the-cat\"\u003e\u003c/div\u003e\n\u003cscript\u003e\n    window.game = new CatchTheCatGame({\n        w: 11,\n        h: 11,\n        r: 20,\n        initialWallCount: 8,\n        backgroundColor: 0xeeeeee,\n        parent: 'catch-the-cat',\n        statusBarAlign: 'center',\n        credit: 'github.com/ganlvtech'\n    });\n\u003c/script\u003e\n```\n\n参数列表：\n\n| 参数  | 值    | 说明       |\n| :---: | :---: | :--------- |\n| w     | `11`  | 横向格子数 |\n| h     | `11`  | 竖向格子数 |\n| r     | `20`  | 圆半径像素 |\n\n非必选参数：\n\n| 参数            | 值                     | 说明                                |\n| :-------------: | :--------------------- | :---------------------------------- |\n| backgroundColor | `0xeeeeee`             | 背景颜色                            |\n| parent          | `catch-the-cat`        | 父元素的 id 或 DOM 对象             |\n| statusBarAlign  | `center`               | 状态栏左对齐 `left` 或居中 `center` |\n| credit          | `github.com/ganlvtech` | 右下角的备注信息                    |\n\n## 自己编写算法\n\n参考 `src/solvers/` 中提供的例子编写算法，并使用下列代码替换。\n\n```js\nwindow.game.solver = yourSolver;\n```\n\n这个 solver 的返回值即为猫要往哪个方向走一步，如果撞墙则算玩家获胜\n\n| 值 | 说明 |\n| :--- | :---------------------- |\n| -1 | 猫主动弃权 |\n| 0  | 左 |\n| 1  | 左上 |\n| 2  | 右上 |\n| 3  | 右 |\n| 4  | 右下 |\n| 5  | 左下 |\n\n猫站在星号的位置，数字代表每个方向的编号\n\n```plain\n 1 2\n0 * 3\n 5 4\n```\n\n例如\n\n```js\nwindow.game.solver = function (blocksIsWall, i, j) {\n    return 0;\n};\n```\n\n即：一直向左走，直到撞墙。\n\n## 说明\n\n* 游戏的思路和小猫的图片来源于 [www.gamedesign.jp](https://www.gamedesign.jp/flash/chatnoir/chatnoir.html)，原来的游戏名叫 Chat Noir，我只是尝试用 javascript 重写一遍。\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganlvtech%2Fphaser-catch-the-cat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganlvtech%2Fphaser-catch-the-cat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganlvtech%2Fphaser-catch-the-cat/lists"}