let current = GetCurrentScriptDirectory; function px(){return GetPlayerX;} function py(){return GetPlayerY;} function stgw(){return GetStgFrameWidth;} function stgh(){return GetStgFrameHeight;} function centerX(){return GetStgFrameWidth/2;} function centerY(){return GetStgFrameHeight/2;} task PlayerExplode(path){ let obj = ObjPrim_Create(OBJ_SPRITE_2D); ObjRender_SetBlendType(obj, BLEND_ADD_RGB); Obj_SetRenderPriority(obj, 0.60); ObjPrim_SetTexture(obj, path); ObjSprite2D_SetSourceRect(obj, 0, 0, 63, 63); ObjSprite2D_SetDestRect(obj, -32, -32, 32, 32); let alpha = 255; let scale = 0; loop(30){ scale += 0.2; alpha -= 8; ObjRender_SetColor(obj, alpha, alpha, alpha); ObjRender_SetPosition(obj, GetPlayerX, GetPlayerY, 0); ObjRender_SetScaleXYZ(obj, scale, scale, 1); yield; } Obj_Delete(obj); } task TMagicCircle { let countVertex = 64; let listRadius = []; loop(countVertex) { listRadius = listRadius ~ [0]; } let path = current ~ "img/Default_Player_MagicCircle.png"; let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D); ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP); ObjPrim_SetVertexCount(obj, countVertex); ObjRender_SetBlendType(obj, BLEND_ADD_RGB); Obj_SetRenderPriority(obj, 0.60); ObjPrim_SetTexture(obj, path); ascent(iVert in 0..countVertex / 2) { let left = iVert * 128; let indexVert = iVert * 2; ObjPrim_SetVertexUVT(obj, indexVert + 0, left, 0); ObjPrim_SetVertexUVT(obj, indexVert + 1, left, 64); } let cx = 0; let cy = 0; let maxRadius = 128; let alpha = 0; let frame = 0; let angleRender = 0; let frameInvOld = 0; while(true) { let frameInv = GetPlayerInvincibilityFrame(); if(frameInv <= 0) { Obj_SetVisible(obj, false); frameInvOld = 0; } else { if(frameInvOld == 0) { ascent(iVert in 0..countVertex) { listRadius[iVert] = 0; } alpha = 0; frame = 0; } frameInvOld = frameInv; let px = GetPlayerX(); let py = GetPlayerY(); alpha += 1 / 120; alpha = min(alpha, 1); angleRender += 360 / countVertex / 2; Obj_SetVisible(obj, true); frameInv = min(100, frameInv); let rRate = frameInv / 100; ascent(iVert in 0..countVertex / 2) { let indexVert = iVert * 2; let angle = 360 / (countVertex / 2 - 1) * iVert; let vx1 = listRadius[indexVert] * cos(angle); let vy1 = listRadius[indexVert] * sin(angle); ObjPrim_SetVertexPosition(obj, indexVert + 0, vx1, vy1, 0); let vx2 = listRadius[indexVert+1] * cos(angle); let vy2 = listRadius[indexVert+1] * sin(angle); ObjPrim_SetVertexPosition(obj, indexVert + 1, vx2, vy2, 0); if(frame >= 0) { let dr = (maxRadius * rRate - listRadius[indexVert]) / 8; listRadius[indexVert] = listRadius[indexVert] + dr; } if(frame > 10) { let rRateIn = rRate - 0.12; if(rRateIn < 0){rRateIn=0;} let dr= (maxRadius * rRateIn - listRadius[indexVert + 1]) / 16; listRadius[indexVert + 1] = listRadius[indexVert + 1] + dr; } } ObjRender_SetColor(obj, 192 * alpha, 192 * alpha, 255 * alpha); ObjRender_SetPosition(obj, px, py, 0); ObjRender_SetAngleZ(obj, angleRender); frame++; } yield; } } task GrazePiece{ let obj = ObjPrim_Create(OBJ_SPRITE_2D); ObjPrim_SetTexture(obj, GetCurrentScriptDirectory ~ "img/graze_eff.png"); ObjSprite2D_SetSourceRect(obj, 0, 0, 32, 32); ObjSprite2D_SetDestCenter(obj); ObjRender_SetBlendType(obj, BLEND_ADD_RGB); ObjRender_SetScaleXYZ(obj, 0.2, 0.2, 0.2); ObjRender_SetPosition(obj, GetPlayerX, GetPlayerY, 0); let s = 0.2; let a = rand(0, 360); let x = GetPlayerX; let y = GetPlayerY; while(s > 0){ ObjRender_SetScaleXYZ(obj, s, s, s); ObjRender_SetPosition(obj, x, y, 0); s -= 0.01; x += 10*cos(a); y += 10*sin(a); yield; } Obj_Delete(obj); }