Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

快速上手:制作第一个游戏 #2207

Closed
ablupi opened this issue Jul 28, 2022 · 3 comments
Closed

快速上手:制作第一个游戏 #2207

ablupi opened this issue Jul 28, 2022 · 3 comments

Comments

@ablupi
Copy link

ablupi commented Jul 28, 2022

URL : https://github.com/cocos-creator/creator-docs/blob/master/zh/getting-started/first-game/index.md

文档在“添加游戏结束逻辑”这一步骤时,新增了onOnceJumpEnd函数,却没有进行调用,导致无法监听到跳跃结束的事件,进而无法进入到游戏结束的逻辑中。需要在“添加游戏结束逻辑”这一步骤的中添加对onOnceJumpEnd函数的调用,或许新增以下代码能解决问题:

    update (deltaTime: number) {
        if (this._startJump) {
            this._curJumpTime += deltaTime;
            if (this._curJumpTime > this._jumpTime) {
                // end
                this.node.setPosition(this._targetPos);
                this._startJump = false;
                this.onOnceJumpEnd();    // 调用onOnceJumpEnd函数
            } else {
                // tween
                this.node.getPosition(this._curPos);
                this._deltaPos.x = this._curJumpSpeed * deltaTime;
                Vec3.add(this._curPos, this._curPos, this._deltaPos);
                this.node.setPosition(this._curPos);
            }
        }
    }
@boogoo619
Copy link

真乃活菩萨!

@UniqueDisplayNameIsInUse

感谢反馈,已在文档中添加注意事项

@UniqueDisplayNameIsInUse

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants