#東方弾幕風 #Title[tes] #Text[] #Image[] #BackGround[] #BGM[] #PlayLevel[] #Player[] #ScriptVersion[2] script_enemy_main{ let name = ""; let csd = GetCurrentScriptDirectory; let imgBoss =csd~"img\ExRumia.png"; let xIni = GetCenterX; let yIni = GetClipMinY+128; @Initialize{ CutIn(YOUMU, name, "", 0, 0, 0, 0); SetLife(2000); SetTimer(60); SetScore(20000000); SetDamageRate(5, 5); LoadGraphic(imgBoss); SetTexture(imgBoss); setGraphicStop; TMain; } @MainLoop{ SetCollisionA(GetX, GetY, 32); SetCollisionB(GetX, GetY, 16); yield; } @DrawLoop{ DrawGraphic(GetX,GetY); } @Finalize{ DeleteGraphic(imgBoss); } task TMain{ yield; TRate; standBy; Laser(0, GetX, GetY, 90, RED01, 0); } task TRate{ wait(240); SetDamageRate(40,40); } sub standBy{ let wIni = 60; SetMovePosition02(xIni,yIni, wIni); setGraphicMove; SetInvincibility(wIni); wait(wIni); setGraphicPose; } task Laser(num, x, y, angle, grp, delay){ let obj = Obj_Create(OBJ_LASER); Obj_SetX(obj, x); Obj_SetY(obj, y); Obj_SetAngle(obj, angle); ObjShot_SetGraphic(obj, grp); ObjShot_SetDelay(obj, delay); ObjLaser_SetLength(obj, 32); ObjLaser_SetWidth(obj, 5); ObjLaser_SetSource(obj, false); wait(5); let x = ObjLaser_GetEndX(obj); let y = ObjLaser_GetEndY(obj); if(Obj_GetY(obj)<=GetClipMaxY){ alternative(num) case(0){ Laser(1, x, y, 45, RED01, 0); Laser(1, x, y, 135, RED01, 0); } case(1){ Laser(0, x, y, 90, RED01, 0); } wait(120); Obj_Delete(obj); } } task TMove{ loop{ wait(120); moveToPlayer(rand(40,80), rand(-40,40), 60, GetClipMinX + 64, GetClipMinY + 32,GetClipMaxX - 64, GetClipMinY + 160); } } function moveToPlayer(xMove, yAdd, frame, left, top, right, bottom) { //自機方向へ移動 let x; let y; if(GetPlayerX < GetX) { x = GetX - xMove; if(x < left) { x = GetX + xMove; } } else { x = GetX + xMove; if(right < x) { x = GetX - xMove; } } y = GetY + yAdd; if(y < top) { y = top; } else if(bottom < y) { y = bottom; } SetMovePosition02(x, y, frame); setGraphicMove; wait(frame); setGraphicStop; } sub setGraphicStop { SetGraphicRect( 0, 0, 64, 64); } sub setGraphicPose { SetGraphicRect( 64, 0, 128, 64); } sub setGraphicLeft { SetGraphicRect(128, 0, 192, 64); } sub setGraphicRight { SetGraphicRect(192, 0, 256, 64); } sub setGraphicMove { if(GetSpeedX < 0) { setGraphicLeft; } else { setGraphicRight; } } function wait(w){ loop(w){yield;} } }