Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def changeThings() = {
- /*
- * pitää huolen siitä että ei kasaannu liikaa täpliä.
- * katso removeDot. dequeueAll poistaa kaikki, jotka palauttavat arvon true
- */
- dots.dequeueAll(removeDot)
- if (waitTime == waitHolder) {
- var deg = 0
- while (deg <= 360) { // muutettu while loopiksi optimisaation vuoksi. for loop toiminnallisesti sama
- dots.enqueue(new Dot(deg, circleRadius, circlePos.x.toInt, circlePos.y.toInt))
- deg += rotation // askeltaa rotationin verran
- }
- circlePos = new Pos(circlePos.x + cos(math.random*2*Pi)*5 , circlePos.y + sin(math.random*2*Pi)*5)
- waitTime = 0
- } else waitTime += 1
- dots.foreach(_.move)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement