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 | // Fish demo (Sprite) var pc= new PanCake(); var fish= new Array(8); pc.reset(); pc.sStart(4); function Fish(){ this .x=rnd(70); this .y=rnd(32); this .dx=1; } var i=0; while (i<fish.length){ fish[i]= new Fish(); pc.sCreate(i,0x2f); i=i+1; } while (1){ var i=0; while (i<fish.length){ pc.sMove(i,fish[i].x,fish[i].y); fish[i].x=fish[i].x+fish[i].dx; if ((fish[i].x<0)+(fish[i].x>72)){fish[i].dx=-fish[i].dx;} if (fish[i].dx>0){ pc.sFlip(i,0); } else { pc.sFlip(i,1); } i=i+1; } } |