1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
// Note: This still needs to be ported to lua
var bsizx,bsizy,cpud1;
function main() {
var i,alti,j,factor,direct,
touchcnt,x,y,delay,bx,by,vbx,vby;
bsizx=64;
bsizy=64;
j=side();
factor=j*2-1;
delay=0;
while (1) {
stop();
stopjump();
bx=ballx();
by=bally();
vbx=bspeedx();
vby=bspeedy();
touchcnt=touches();
x=posx();
y=posy();
direct=1;
i=estimate(200);
if (i>-9000) {
alti=i;
if (j==1) {
if (i>800-bsizx /2) {
i=1600-i-bsizx;direct=0;
}
if (i<405+bsizx /2) {
i=810+bsizx-i;direct=0;
}
if (i<500) {
if (touchcnt<2) {
i=i-bsizx /2;
}
}
} else {
if (i<0+bsizx /2) {
i=-i+bsizx;
direct=0;
}
if (i>395-bsizx /2) {
i=790-bsizx-i;
direct=0;
}
if (i>300) {
if (touchcnt<2) {
i=i+bsizx /2;
}
}
}
i=i+(bsizx / 3)*factor;
//if (i>=x+7) right();
//if (i<=x-7) left();
moveto(i);
}
stopjump();
if(vby<=10)
if (factor*(x-bx)<21)
if (factor*(bx-x)<7)
if (abs(bx-x)<120)
if (abs(vby)<65)
if (by>200)
if (by-y>70)
if ((by<400) || (vby==0))
if (abs(vbx)<20)
if (!balldown()) jump();
if (random(300)==0) jump();
if (i>-9000) {
if ((abs(i-x)>75) && (abs(bx-x)<65) && (vby<0) ) {
jump();
}
}
if (touching()) {
stop();
}
if (!launched()) {
delay+=1;
stopjump();
if (delay>=30) jump();
}
wait();
} //while
} //function
|