shiny-cuty-excel-chiffon/data/e830_ctrl2.asd

276 lines
12 KiB
Common Lisp
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


*start
[wait frame=1]
[iscript]
{
if(tf.beizel !== void && isvalid tf.beizel){
mp.parent = tf.beizel;
}else{
mp.parent = bao.enemies[mp.bNum];
}
dm(mp.tNum);
dm(mp.bNum);
dm(mp.parent);
mp.parent.layer.conductor.mp.ctrl = sprite;
mp.inverse = !mp.parent.inverse;
mp.tentacleR = 60;
mp.tentacleNum = 4;
mp.targetAngle = [];
mp.nowAngle = [];
mp.posV = [];
mp.axis = new Vector(0, 0, 1);
for(var i=0; i<mp.tentacleNum; i++){
mp.nowAngle[i] = mp.targetAngle[i] = 90 * i + 30;
mp.posV[i] = new Vector(mp.tentacleR, 0, 0);
mp.posV[i].transform(mp.axis, mp.targetAngle[i]);
var t = tf.tentacleBases[mp.tNum][i];
t.layer.conductor.mp.parent = sprite;
t.layer.conductor.mp.num = i;
t.tentacle.num = i;
t.rootX = mp.parent.rootX + mp.posV[i].x * 0.5;
t.rootY = mp.parent.rootY + mp.posV[i].y * 0.5 * 0.3;
}
mp.targetAngle2 = -30;
mp.nowAngle2 = -30;
}
[endscript]
[ontrigger name=delete target=*delete]
[ontrigger name=disappear target=*disappear]
*loop
[wait frame=1]
;[jump target=*delete cond="mp.parent === void || !isvalid mp.parent"]
[iscript]
{
if(tf.beizel !== void && isvalid tf.beizel){
mp.parent = tf.beizel;
}
if(mp.ox === void) mp.ox = mp.x;
if(mp.oy === void) mp.oy = mp.y;
mp.inverse = mp.parent.inverse;
if(mp.inverse){
if(!tf.tentacleBases[mp.tNum][0].layer.conductor.mp.alive && !tf.tentacleBases[mp.tNum][3].layer.conductor.mp.alive){
if(tf.tentacleBases[mp.tNum][2].layer.conductor.mp.alive){
// 2が生きていたら3と入れ替え
mp.posV[3].transform(mp.axis, mp.nowAngle[2]-mp.nowAngle[3]);
tf.tentacleBases[mp.tNum][2] <-> tf.tentacleBases[mp.tNum][3];
mp.nowAngle[3] = mp.nowAngle[2];
}
}
if(tf.tentacleBases[mp.tNum][0].layer.conductor.mp.alive){
mp.targetAngle[0] = 30;
mp.targetAngle[1] = 120;
}else{
if(tf.tentacleBases[mp.tNum][1].layer.conductor.mp.alive){
mp.targetAngle[1] = 30;
}
}
if(tf.tentacleBases[mp.tNum][3].layer.conductor.mp.alive){
mp.targetAngle[3] = 300;
mp.targetAngle[2] = 210;
}else{
if(tf.tentacleBases[mp.tNum][2].layer.conductor.mp.alive){
mp.targetAngle[2] = 300;
}
}
}else{
if(!tf.tentacleBases[mp.tNum][2].layer.conductor.mp.alive && !tf.tentacleBases[mp.tNum][3].layer.conductor.mp.alive){
if(tf.tentacleBases[mp.tNum][0].layer.conductor.mp.alive){
// 0が生きていたら3と入れ替え
mp.posV[3].transform(mp.axis, mp.nowAngle[0]-mp.nowAngle[3]);
tf.tentacleBases[mp.tNum][0] <-> tf.tentacleBases[mp.tNum][3];
mp.nowAngle[3] = mp.nowAngle[0] + 360;
}
}
if(tf.tentacleBases[mp.tNum][2].layer.conductor.mp.alive){
mp.targetAngle[2] = 150;
mp.targetAngle[1] = 60;
}else{
if(tf.tentacleBases[mp.tNum][1].layer.conductor.mp.alive){
mp.targetAngle[1] = 150;
}
}
if(tf.tentacleBases[mp.tNum][3].layer.conductor.mp.alive){
mp.targetAngle[3] = 240;
mp.targetAngle[0] = -30;
}else{
if(tf.tentacleBases[mp.tNum][0].layer.conductor.mp.alive){
mp.targetAngle[0] = -120;
}
}
}
for(var i=0; i<mp.tentacleNum; i++){
if(mp.targetAngle[i] < mp.nowAngle[i]){
mp.posV[i].transform(mp.axis, -5);
mp.nowAngle[i] -= 5;
}else if(mp.targetAngle[i] > mp.nowAngle[i]){
mp.posV[i].transform(mp.axis, 5);
mp.nowAngle[i] += 5;
}
}
for(var i=0; i<mp.tentacleNum; i++){
var t = tf.tentacleBases[mp.tNum][i];
if(t.followParent){
var flag = false;
switch (mp.parent.nowSpriteId){
case stDamage2:
case stThrown1:
case stThrown2:
case stThrown3:
case stThrown4:
case stThrown5:
case stThrown6:
flag = true;
}
if((flag || getDistance(mp.parent, t) > 19600) && t.nowSpriteId != stStandUp){
t.followParent = false;
t.loadSprite(stStandUp);
}else{
var tx = mp.parent.rootX + mp.posV[i].x;
var ty = mp.parent.rootY + mp.posV[i].y * 0.3;
var dx = tx - t.rootX;
var dy = ty - t.rootY;
var l = Math.sqrt(dx*dx + dy*dy);
var d = 8 / l;
if(d > 1) d = 0.5;
t.rootX += dx * d;
t.rootY += dy * d;
}
}
if(t.locateResetFlag){
t.rootX = mp.parent.rootX + mp.posV[i].x * 0.5;
t.rootY = mp.parent.rootY + mp.posV[i].y * 0.5 * 0.3;
t.locateResetFlag = false;
}
}
}
[endscript]
[jump target=*disappear cond="mp.parent.HP <= 0"]
[jump target=*loop]
*disappear
[ontrigger name=appear target=*appear]
[iscript]
//dm(bao.tickCount + " ■ e830_ctrl disappear");
for(var i=0; i<mp.tentacleNum; i++){
//dm(i);
var t = tf.tentacleBases[mp.tNum][i];
// t.tentacle.damageTick = bao.tickCount + 2000;
t.tentacle.stop = false;
if(!t.tentacle.isDead){
t.tentacle.ignoreDamage = true;
t.tentacle.disableAttackCount = 10;
t.tentacle.loadAsd("e830_tentacle_disappear");
}
}
[endscript]
*disappear_loop
[jump target=*dead cond="!isvalid mp.paremt || mp.parent.HP <= 0"]
[wait frame=1]
[jump target=*disappear_loop]
*appear
[ontrigger name=disappear target=*disappear]
[iscript]
for(var i=0; i<mp.tentacleNum; i++){
var t = tf.tentacleBases[mp.tNum][i];
t.followParent = true;
if(!t.layer.conductor.mp.alive){
mp.x = mp.ox = mp.parent.rootX;
mp.y = mp.oy = mp.parent.rootY;
t.rootX = mp.x + mp.posV[i].x;
t.rootY = mp.y + mp.posV[i].y * 0.3;
if(!t.tentacle.isDead){
t.layer.trigger('appear');
}
}
}
[endscript]
;[wait frame=14]
[iscript]
for(var i=0; i<mp.tentacleNum; i++){
var t = tf.tentacleBases[mp.tNum][i];
if(!t.tentacle.isDead && t.onRevive){
t.tentacle.loadAsd("e830_tentacle_appear");
}
}
[endscript]
[jump target=*loop]
*dead
[iscript]
for(var i=0; i<mp.tentacleNum; i++){
var t = tf.tentacleBases[mp.tNum][i];
if(t !== void && isvalid t && !t.tentacle.isDead){
t.tentacle.dead();
}
}
[endscript]
[wait frame=10]
[iscript]
for(var i=0; i<mp.tentacleNum; i++){
var t = tf.tentacleBases[mp.tNum][i];
if(t !== void && isvalid t && !t.tentacle.isDead){
t.loadSprite(stEscape);
t.deleteFlag = true;
}
}
[endscript]
[del]
[s]