Hello! Recently, I've been following Sparen's Danmakufu Tutorials, where I've begun making circles. However, When I add the code for the circle and boot up the application, I get an error saying "GetCenterX" isn't defined. The problem is that I edit the code in the MainTask task, whereas GetCenterX is in @Initialize. I'll post the code below.
#東方弾幕風[Single]
#ScriptVersion[3]
#Title["TestA"]
#Text["Uhhh"]
#include "script/default_system/Default_ShotConst.txt"
let objBoss;
let objScene=GetEnemyBossSceneObjectID();
@Event{
alternative(GetEventType())
case(EV_REQUEST_LIFE){
SetScriptResult(500);
}
case(EV_REQUEST_TIMER){
SetScriptResult(60);
}
case(EV_REQUEST_SPELL_SCORE){
SetScriptResult(1000000);
}
}
@Initialize{
objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
ObjEnemy_Regist(objBoss);
ObjMove_SetDestAtFrame(objBoss, GetCenterX, 60, 60);
ObjEnemyBossScene_StartSpell(objScene);
TDrawLoop;
TFinalize;
MainTask;
}
@MainLoop{
ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32);
ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
yield;
}
task MainTask{
wait(120);
movement;
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
let angleT = GetAngleToPlayer(objBoss);
loop (13){
CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, angleT, DS_BALL_S_RED, 5);
angleT += 360/13;
}
}
task movement{
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
ObjMove_SetDestAtFrame(objBoss, rand(GetCenterX + 90, GetCenterX - 90), rand(GetCenterY - 60, GetCenterY - 120), 60);
wait(240);
}
}
task TDrawLoop {
let imgExRumia = GetCurrentScriptDirectory() ~ "ExRumia.png";
ObjPrim_SetTexture(objBoss, imgExRumia);
ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);
ObjSprite2D_SetDestCenter(objBoss);
}
task TFinalize {
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
+ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
}
Obj_Delete(objBoss);
DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
SetAutoDeleteObject(true);
CloseScript(GetOwnScriptID());
return;
}
function GetCenterX(){
return GetStgFrameWidth() / 2;
}
function GetCenterY(){
return GetStgFrameHeight() / 2;
}
function wait(n){
loop(n){yield;}
}
As seen above, GetCenterX is in line 24, the line that moves the boss. The code I edit is in lines 35-44. I simply can't wrap my head around this. If I'm doing something wrong please tell me.