daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def changeThings() = {
  2.  
  3.     /*
  4.      *  pitää huolen siitä että ei kasaannu liikaa täpliä.
  5.      *  katso removeDot. dequeueAll poistaa kaikki, jotka palauttavat arvon true
  6.      */
  7.  
  8.     dots.dequeueAll(removeDot)
  9.  
  10.     if (waitTime == waitHolder) {
  11.       var deg = 0
  12.       while (deg <= 360) { // muutettu while loopiksi optimisaation vuoksi. for loop toiminnallisesti sama
  13.         dots.enqueue(new Dot(deg, circleRadius, circlePos.x.toInt, circlePos.y.toInt))
  14.         deg += rotation // askeltaa rotationin verran
  15.       }
  16.    
  17.     circlePos = new Pos(circlePos.x + cos(math.random*2*Pi)*5 , circlePos.y + sin(math.random*2*Pi)*5)
  18.  
  19.       waitTime = 0
  20.     } else waitTime += 1
  21.  
  22.     dots.foreach(_.move)
  23.  
  24.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top