async battleStart(){ this.f_runtime.globalVars.isAttack = true; var tempHp = this.f_runtime.globalVars.hp; var tempEnemyHp = this.f_runtime.globalVars.enemy_hp; for(var i = 0; i < 20; i++){ // 0.1초마다 상대체력의 5%의 데미지를 받는다... this.f_runtime.globalVars.hp -= tempEnemyHp/20; this.f_runtime.globalVars.enemy_hp -= tempHp/20; if(this.f_runtime.globalVars.hp <= 10) { await this.f_runtime.callFunction("warningHp"); // await sleep(2000); } if(this.f_runtime.globalVars.hp <= 0 || this.f_runtime.globalVars.enemy_hp <= 0) { this.f_runtime.callFunction("endBattle"); break; } await sleep(100); } this.f_runtime.globalVars.isAttack = false; }
runtime.callFuntion Even if waiting, it will proceed. What's going on?
Can you help me?
runtime.callFunction is synchronous. There is no point awaiting it.
So how to wait for callFunction?
My code continues without stopping.
Develop games in your browser. Powerful, performant & highly capable.
Waiting on callFunction is not currently supported.
Normally the function completes synchronously anyway. Are you using an async function in the event sheet?
How do I check if this is asynchronous?
Currently, you cannot. But you could call a JavaScript function at the end of that event block, and then you know it finished when that function is called.