SHARE
TWEET

Untitled

a guest Jun 19th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var showMostDistantTadpole = function() {
  2.     if (arguments[0]) {
  3.         var dir = arguments[0];
  4.     }
  5.     else {
  6.         var dir = false;
  7.     }
  8.     var most = 0;
  9.     var mostID = 0;
  10.     for (var w in app.model.tadpoles) {
  11.         tad = app.model.tadpoles[w];
  12.         if (dir == 'x') {
  13.             curr = tad.x.toFixed(0);
  14.         }
  15.         if (dir == 'y') {
  16.             curr = tad.y.toFixed(0);
  17.         }
  18.         if (dir == false) {
  19.             cx = (tad.x > 0 ? tad.x : tad.x * -1);
  20.             cy = (tad.y > 0 ? tad.y : tad.y * -1);
  21.             curr = cx.toFixed(0) + cy.toFixed(0);
  22.         }
  23.         if (curr > most) {
  24.             console.log(curr + ' :: ' + w);
  25.             most = curr;
  26.             mostID = w;
  27.         }
  28.     }
  29.     return w + ' :: ' + tad.name + ' :: (' + tad.x.toFixed(0) + ', ' + tad.y.toFixed(0) + ')';
  30. };
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top