Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kaboomjs-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazy-template
kaboomjs-template
Commits
10c4c5af
Commit
10c4c5af
authored
Sep 17, 2025
by
xiezhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化README.md格式
- 将代码块改为顶格写,提高可读性 - 移除不必要的缩进 - 保持文档结构清晰
parent
69928630
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
52 deletions
+52
-52
README.md
README.md
+52
-52
No files found.
README.md
View file @
10c4c5af
...
@@ -17,41 +17,41 @@ KaboomJS 是一个轻量级的 JavaScript 游戏引擎,专为快速原型开
...
@@ -17,41 +17,41 @@ KaboomJS 是一个轻量级的 JavaScript 游戏引擎,专为快速原型开
### 本地开发
### 本地开发
1.
**克隆项目**
1.
**克隆项目**
```
bash
```
bash
git clone <repository-url>
git clone <repository-url>
cd
kaboomjs-template
cd
kaboomjs-template
```
```
2.
**安装依赖**
2.
**安装依赖**
```
bash
```
bash
make
install
make
install
# 或者
# 或者
npm
install
npm
install
```
```
3.
**启动开发服务器**
3.
**启动开发服务器**
```
bash
```
bash
make dev
make dev
# 或者
# 或者
npm run dev
npm run dev
```
```
4.
**打开浏览器访问**
4.
**打开浏览器访问**
```
```
http://localhost:3000
http://localhost:3000
```
```
### Docker 部署
### Docker 部署
1.
**构建并运行 Docker 容器**
1.
**构建并运行 Docker 容器**
```
bash
```
bash
make docker-run
make docker-run
```
```
2.
**访问游戏**
2.
**访问游戏**
```
```
http://localhost:3000
http://localhost:3000
```
```
## 🎮 游戏说明
## 🎮 游戏说明
...
@@ -111,31 +111,31 @@ kaboomjs-template/
...
@@ -111,31 +111,31 @@ kaboomjs-template/
### 自定义游戏
### 自定义游戏
1.
**修改游戏设置**
1.
**修改游戏设置**
```javascript
```
javascript
const k = kaboom({
const
k
=
kaboom
({
width
:
800
,
// 游戏宽度
width
:
800
,
// 游戏宽度
height
:
600
,
// 游戏高度
height
:
600
,
// 游戏高度
background
:
[
135
,
206
,
235
],
// 背景色
background
:
[
135
,
206
,
235
],
// 背景色
debug
:
true
,
// 调试模式
debug
:
true
,
// 调试模式
});
});
```
```
2.
**添加新的精灵和音效**
2.
**添加新的精灵和音效**
```javascript
```
javascript
k.loadSprite("newSprite", "path/to/sprite.png");
k
.
loadSprite
(
"newSprite"
,
"path/to/sprite.png"
);
k.loadSound("newSound", "path/to/sound.wav");
k
.
loadSound
(
"newSound"
,
"path/to/sound.wav"
);
```
```
3.
**创建新的游戏对象**
3.
**创建新的游戏对象**
```javascript
```
javascript
const newObject = k.add([
const
newObject
=
k
.
add
([
k
.
sprite
(
"newSprite"
),
k
.
sprite
(
"newSprite"
),
k
.
pos
(
x
,
y
),
k
.
pos
(
x
,
y
),
k
.
area
(),
k
.
area
(),
k
.
body
(),
k
.
body
(),
"newTag"
"newTag"
]);
]);
```
```
## 🔧 可用命令
## 🔧 可用命令
...
@@ -207,18 +207,18 @@ docker run -d -p 3000:3000 kaboomjs-game
...
@@ -207,18 +207,18 @@ docker run -d -p 3000:3000 kaboomjs-game
### 修改游戏外观
### 修改游戏外观
1.
**背景颜色**
1.
**背景颜色**
```javascript
```
javascript
background: [R, G, B] // RGB 颜色值
background
:
[
R
,
G
,
B
]
// RGB 颜色值
```
```
2.
**游戏尺寸**
2.
**游戏尺寸**
```javascript
```
javascript
width: 800, // 宽度
width
:
800
,
// 宽度
height: 600, // 高度
height
:
600
,
// 高度
```
```
3.
**UI 样式**
3.
**UI 样式**
修改 `index.html` 中的 CSS 样式
修改
`index.html`
中的 CSS 样式
## 🔍 调试和开发
## 🔍 调试和开发
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment