Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Single]
- #ScriptVersion[3]
- #Title["lolmyscript"]
- #Text["this is a script"]
- //Load the default shotsheet
- #include"script/default_system/Default_ShotConst.txt"
- //----------------------------------------------------
- //Declaring Global Variables
- //The variables declared here can be used throughout the entire script.
- //However, the variables declared here are static. (They can be changed, but not by themselves as they are not in the main loop)
- //(As execution order cannot be guaranteed, random numbers cannot be used(?))
- //----------------------------------------------------
- let objEnemy; //Enemy object
- let frame = 0; //Counter for timing enemy movements.(Will keep increasing by one in @MainLoop)
- let frame2 = 0;
- //----------------------------------------------------
- //Enemy movement
- //----------------------------------------------------
- @Event
- {
- alternative(GetEventType())
- case(EV_REQUEST_LIFE)
- {
- //The script requests the enemy life
- SetScriptResult(5000);//Set enemy life to 500
- }
- }
- @Initialize
- {
- //Create and register the enemy object
- objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
- ObjEnemy_Regist(objEnemy);
- //Setting the enemy's image
- let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png"; //file path to enemy image
- ObjPrim_SetTexture(objEnemy, imgExRumia); //Setting the above image file as a texture to the enemy object(objEnemy)
- ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64); //Setting the rectangle coordinates in the enemy image to use(Left, Top, Right, Bottom).
- ObjSprite2D_SetDestCenter(objEnemy); //Positioning the center of the rectangle(w/texture) at (0, 0) on the stage(top left corner).
- //Moving to the coordinate (cx, 60) in 60 frames
- let cx = GetStgFrameWidth() / 2;//defines the variable cx as the horizontal middle of the stage. (Stage width / 2)
- ObjMove_SetDestAtFrame(objEnemy, cx, 180, 60);
- }
- @MainLoop
- {
- //retrieving enemy coordinates
- let ex = ObjMove_GetX(objEnemy);
- let ey = ObjMove_GetY(objEnemy);
- let px = ObjMove_GetX(GetPlayerX);
- let py = ObjMove_GetY(GetPlayerY);
- let angleToPlayer = atan2(py - ey, px - ex);
- let randx = rand(0,300);
- let randy = rand(0,300);
- let randex = rand(-50,50);
- let randey = rand(0,30);
- if (frame>0&&frame%260==0){
- ObjMove_SetDestAtWeight(objEnemy,randx,randy,9,3);
- let angle=0;
- while(angle<360){
- curvelaser(ex,ey,5,angle,75,10,-2,DS_LIGHT_WHITE,30);
- curvelaser(ex,ey,5,angle,75,10,2,DS_LIGHT_GREEN,30);
- curvelaser(ex,ey,4,angle,75,10,-4.5,DS_LIGHT_YELLOW,30);
- curvelaser(ex,ey,4,angle,75,10,4.5,DS_LIGHT_ORANGE,30);
- curvelaser(ex,ey,3,angle,75,10,-1.5,DS_LIGHT_SKY,30);
- curvelaser(ex,ey,3,angle,75,10,1.5,DS_LIGHT_BLUE,30);
- curvelaser(ex,ey,2.5,angle,75,10,-3.75,DS_LIGHT_RED,30);
- curvelaser(ex,ey,2.5,angle,75,10,3.75,DS_LIGHT_PURPLE,30);
- angle+=60
- }
- }
- if (frame2>0&&frame2%1==0){
- let jangle= -20;
- while(jangle <= 20){
- bulletshot(ex,ey,2.5,jangle + (2.13*frame2),DS_NEEDLE_RED,15);
- bulletshot(ex,ey,2.5,jangle + (-2.13*frame2),DS_NEEDLE_BLUE,15);
- wait(3);
- bulletshot(ex,ey,2.5,jangle + (2.13*frame2)+180,DS_NEEDLE_ORANGE,15);
- bulletshot(ex,ey,2.5,jangle + (-2.13*frame2)+180,DS_NEEDLE_SKY,15);
- jangle += 10;
- }
- }
- yield;
- //Setting the enemy hit box
- ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);//hitbox against player bullets. 32 is the radius.
- ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24);//hitbox against the player. 24 is the radius.
- //adding +1 to frame. "frame++" is equivalent to "frame = frame + 1;" or "frame += 1;"
- frame++;
- frame2++;
- //If the enemy's life is 0
- if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0)
- {
- //The enemy is killed immediately when life is 0
- //As this is a beginner sample script,
- //the script is ended immediately without waiting for an explosion effect.
- Obj_Delete(objEnemy);
- CloseScript(GetOwnScriptID());
- return;
- }
- task curvelaser(x,y,v,angle,length,width,angvel,graphic,delay){
- let shot1 = ObjShot_Create(OBJ_CURVE_LASER);
- ObjMove_SetPosition(shot1,x,y);
- ObjMove_SetSpeed(shot1,v);
- ObjMove_SetAngle(shot1,angle);
- ObjLaser_SetLength(shot1,length);
- ObjLaser_SetRenderWidth(shot1,width);
- ObjMove_SetAngularVelocity(shot1,angvel);
- ObjShot_SetGraphic(shot1,graphic);
- ObjShot_SetDelay(shot1,delay);
- ObjShot_Regist(shot1);
- ObjMove_AddPatternA3(shot1,130,NO_CHANGE,NO_CHANGE,0,0,3,DS_BALL_L_ORANGE);
- yield;
- }
- task bulletshot(x,y,v,angle,graphic,delay){
- let shot2 = ObjShot_Create(OBJ_SHOT);
- ObjMove_SetPosition(shot2,x,y);
- ObjMove_SetSpeed(shot2,v);
- ObjMove_SetAngle(shot2,angle);
- ObjShot_SetGraphic(shot2,graphic);
- ObjShot_SetDelay(shot2,delay);
- ObjShot_SetAutoDelete(shot2,true);
- ObjShot_Regist(shot2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement