home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / baku100.zip / baku100 / Kernel / Lib / Satellite.tonyu < prev    next >
Text File  |  2002-05-02  |  1KB  |  58 lines

  1. extends Library;
  2.  
  3. native _n_getPatColor;
  4. function getPatColor(p) {
  5.    return _n_getPatColor (_body,p);
  6. }
  7.  
  8. native _n_pset;
  9. function pset(x,y,c) {
  10.    return _n_pset (_body,x,y,c);
  11. }
  12.  
  13. function setScale(wx,wy,scx,scy) {
  14.   this.wx =wx;
  15.   this.wy =wy;
  16.   this.scx =scx;
  17.   this.scy =scy;
  18. }
  19.  
  20. function refresh(y,w) {
  21.    var x,p;
  22.    x=0; 
  23.    if (! $map) return;
  24.    while (w>0) {
  25.       p=$map.getAt(wx+x*scx, wy+y*scy);
  26.       pset(x,y,getPatColor(p));   
  27.       w-=1;
  28.       x+=1;
  29.    }
  30. }
  31.  
  32. function refreshCharPos() {
  33.   var o;
  34.   if (!$chars || $chars.size()==0) return;
  35.   if (charsC>=$chars.size()) { charsC=0;}
  36.   if (rnd(2)==0) col=255-col;
  37.   o=$chars.get(charsC);
  38.   pset((o.x-wx)/scx,(o.y-wy)/scy,color(col,col,col));
  39.   charsC+=1;
  40. }
  41.  
  42. function refreshEx(wx,wy,scx,scy,fy,ty,w) {
  43.   setScale(wx,wy,scx,scy);
  44.   while (fy<ty) {
  45.     refresh(fy,w);
  46.     fy+=1;
  47.     refreshCharPos();
  48.   }
  49. }
  50.  
  51. constructor Satellite(){
  52.    charsC=0;
  53.    col=0;
  54. }
  55.  
  56. function onLoadPage() {
  57.   $satellite=new Satellite();
  58. }