Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Single]
- #ScriptVersion[3]
- #Title["Cirno Spell 2"]
- #Text["A New Spell for Cirno"]
- #include "script/default_system/ZUNShot_Const.txt"
- let bossObj;
- let bossX = 0;
- let bossY = 0;
- let imgBoss = GetCurrentScriptDirectory ~ "cirno.png";
- @Initialize {
- bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
- ObjEnemy_Regist(bossObj);
- ObjMove_SetPosition(bossObj,193,-100);
- ObjMove_SetDestAtSpeed(bossObj,193,120,5);
- mainTask;
- }
- @Event {
- alternative(GetEventType())
- case(EV_REQUEST_LIFE)
- {
- SetScriptResult(2500);
- }
- case(EV_REQUEST_TIMER)
- {
- SetScriptResult(90);
- }
- }
- @MainLoop {
- bossX = ObjMove_GetX(bossObj);
- bossY = ObjMove_GetY(bossObj);
- ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
- ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,30);
- yield;
- if(ObjEnemy_GetInfo(bossObj,INFO_LIFE) <= 0) {
- Obj_Delete(bossObj);
- CloseScript(GetOwnScriptID());
- return;
- }
- }
- @Finalize {
- }
- function wait(w) {
- loop(w) {
- yield;
- }
- }
- task mainTask {
- renderBoss;
- wait(30);
- movement;
- loop {
- wait(60);
- spawner;
- wait(300);
- }
- }
- task movement {
- wait(60);
- loop {
- fire;
- wait(30);
- }
- }
- task renderBoss {
- let dir;
- let speed;
- ObjPrim_SetTexture(bossObj,imgBoss);
- ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
- ObjSprite2D_SetDestCenter(bossObj);
- ObjRender_SetScaleXYZ(bossObj,0.7,0.7,0);
- while(!Obj_IsDeleted(bossObj)) {
- dir = ObjMove_GetAngle(bossObj);
- speed = ObjMove_GetSpeed(bossObj);
- if(speed == 0) {
- ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
- ObjRender_SetAngleXYZ(bossObj,0,0,0);
- }
- else if(cos(dir) < 0) {
- ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
- ObjRender_SetAngleXYZ(bossObj,0,0,0);
- }
- else if(cos(dir) > 0) {
- ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
- ObjRender_SetAngleXYZ(bossObj,0,180,0);
- }
- yield;
- }
- }
- task fire {
- let spin = ObjShot_Create(OBJ_SHOT);
- ObjShot_Regist(spin);
- ObjMove_SetPosition(spin,bossX,bossY);
- ObjMove_SetAngle(spin,rand(0,360));
- ObjMove_SetSpeed(spin,3);
- ObjShot_SetGraphic(spin,144);
- ObjMove_SetAngularVelocity(spin,2);
- let spin2 = ObjShot_Create(OBJ_SHOT);
- ObjShot_Regist(spin2);
- ObjMove_SetPosition(spin2,bossX,bossY);
- ObjMove_SetAngle(spin2,rand(0,360));
- ObjMove_SetSpeed(spin2,3);
- ObjShot_SetGraphic(spin2,144);
- ObjMove_SetAngularVelocity(spin2,-2);
- while(!Obj_IsDeleted(spin)) {
- ObjMove_SetPosition(spin,ObjMove_GetX(spin),ObjMove_GetY(spin)+1);
- yield;
- }
- while(!Obj_IsDeleted(spin2)) {
- ObjMove_SetPosition(spin2,ObjMove_GetX(spin2),ObjMove_GetY(spin2)+1);
- yield;
- }
- }
- task spawner {
- let spawn = ObjShot_Create(OBJ_SHOT);
- ObjShot_Regist(spawn);
- ObjMove_SetPosition(spawn,bossX,bossY);
- ObjMove_SetAngle(spawn,rand(210,330));
- ObjMove_SetSpeed(spawn,2);
- ObjShot_SetGraphic(spawn,286);
- ObjShot_SetSpellResist(spawn,true);
- let shot1 = ObjShot_Create(OBJ_SHOT);
- ObjShot_Regist(shot1);
- ObjMove_SetPosition(shot1,ObjMove_GetX(spawn),ObjMove_GetY(spawn));
- ObjMove_SetAngle(shot1,ObjMove_GetAngle(spawn)+rand(150,210));
- ObjMove_SetSpeed(shot1,2);
- ObjShot_SetGraphic(shot1,275);
- while(!Obj_IsDeleted(spawn)) {
- if(ObjMove_GetX(spawn) > 386 || ObjMove_GetX(spawn) < 0) {
- ObjMove_SetAngle(spawn,180-ObjMove_GetAngle(spawn));
- }
- if(ObjMove_GetY(spawn) < 0) {
- ObjMove_SetAngle(spawn,0-ObjMove_GetAngle(spawn));
- }
- yield;
- }
- while(true) {
- ObjShot_AddShotA1(spawn,shot1,15);
- yield;
- }
- }
- function AngleToPlayer {
- let dir = GetAngleToPlayer(bossObj);
- return dir;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement