Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Dist(fromx, fromy, tox, toy) { return ((tox-fromx)^2+(toy-fromy)^2)^0.5 }
- function AngTo(fromx, fromy, tox, toy) { return atan2(toy-fromy, tox-fromx) }
- task CreateChain {
- let obja = [0, 0, 0];
- task s1 { obja[0] = Obj_Create(OBJ_SHOT); let obj = obja[0];
- Obj_SetPosition(obj, GetClipMinX, -30); ObjShot_SetGraphic(obj, ORANGE03);
- ObjShot_SetBombResist(obj, 1); Obj_SetAutoDelete(obj, 0);
- while(Obj_GetY(obj)<525) { Obj_SetY(obj, Obj_GetY(obj)+2); yield; } Obj_Delete(obj); }
- task s2 { obja[1] = Obj_Create(OBJ_SHOT); let obj = obja[1];
- Obj_SetPosition(obj, GetClipMaxX, -30); ObjShot_SetGraphic(obj, ORANGE03);
- ObjShot_SetBombResist(obj, 1); Obj_SetAutoDelete(obj, 0);
- while(Obj_GetY(obj)<525) { Obj_SetY(obj, Obj_GetY(obj)+2); yield; } Obj_Delete(obj); }
- task s3 {
- task s4(percent) { let obj2 = Obj_Create(OBJ_SHOT);
- ObjShot_SetGraphic(obj2, ORANGE01);
- ObjShot_SetBombResist(obj2, 1); Obj_SetAutoDelete(obj2, 0);
- while(Obj_GetY(obj2)<525) {
- Obj_SetPosition(obj2,
- Obj_GetX(obj)+ObjLaser_GetLength(obj)*percent*cos(Obj_GetAngle(obj))
- ,Obj_GetY(obj)+ObjLaser_GetLength(obj)*percent*sin(Obj_GetAngle(obj))+2
- ); yield;
- }
- Obj_Delete(obj); }
- SetShotColor(255, 155, 0); obja[2] = Obj_Create(OBJ_LASER); let obj = obja[2];
- ObjShot_SetGraphic(obj, ORANGE12); ObjShot_SetDelay(obj, 600);
- ObjShot_SetBombResist(obj, 1); Obj_SetAutoDelete(obj, 0); SetShotColor(255, 255, 255);
- Obj_SetCollisionToPlayer(obj, 0); ObjLaser_SetSource(obj, 0);
- let num = 13; ascent(i in 0..num) { s4(i/num); }
- let a = 0; let b = 0; let r1 = rand(-3, 3); let r2 = rand(-3, 3);
- while(!Obj_BeDeleted(obja[0]) && !Obj_BeDeleted(obja[1])) {
- let x = Obj_GetX(obja[0])+15*cos(a); let y = Obj_GetY(obja[0])+15*sin(a);
- let x2 = Obj_GetX(obja[1])+15*cos(b); let y2 = Obj_GetY(obja[1])+15*sin(b);
- a+=r1; b+=r2; a%=360; b%=360;
- Obj_SetPosition(obj, x, y);
- ObjLaser_SetLength(obj, Dist(x, y, x2, y2));
- Obj_SetAngle(obj, AngTo(x, y, x2, y2));
- yield; } Obj_Delete(obj); }
- s1; s2; s3;
- }
Advertisement
Add Comment
Please, Sign In to add comment