如何在Phaser 3中调用相同类的方法

问题描述

我正在尝试从Phaser中从属于同一类的另一个方法调用一个方法。但是,this.functionName()引发错误(this.functionName不是函数),并且调用this.functionName不会返回任何内容。就像跳过那条线一样。另外,当我从Phaser的create()生命周期方法调用它时,它也可以正常工作。 这是我尝试调用方法代码

 onSelectAnswer(pointer,gameObject) {
    console.log(pointer,gameObject)
    //alert(gameObject.text)
    let answer = gameObject.text
    Questions.forEach((question) => {
        if(answer == question.rightAnswer) {
        this.success = true;
        this.successfulAnswers++;
        console.log('success',this.success)
        //alert(successfulAnswers)
        //this.playFeedback();
        }
    })

    this.activeQuestion = this.nextItem
    this.exerciseFirstQuestion = false
    try {
        console.log('prije')
        /* The line below seems to be the problem */
        this.getQuestion;
        console.log('poslije')
    } catch (error) {
        console.log('err',error)
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)