Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightre committed Feb 14, 2024
1 parent bf64c74 commit 85a3db0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ class Ball extends Graphical {
constructor() {
// ...
this.collision.onBodyEnter = (res) => {
// res 返回碰到的碰撞体,以及overlap
// `res` returns the collision object encountered and overlay
const body = res.body
if (body.tag.has("board")) { // 判断是不是板子
// 获取与板子之间的差
if (body.tag.has("board")) { // Determine if it is a board
// Obtain the difference in coordinates with the board
const rebound = this.globalPosition.sub(body.globalPosition,true)
// 设置方向
// Set direction
this.direction.direction = rebound.direction
// 播放声音
// Play Sound
engine.getAssets("jump").play()
}
}
Expand Down

0 comments on commit 85a3db0

Please sign in to comment.