summaryrefslogtreecommitdiff
path: root/src/graphyx/tests/BallStack.scala
blob: 8e45611d32a10586a65e13dd150459e969d4903e (plain) (blame)
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
/*
 * Graphyx
 * copyright (c) 2009 Jakob Odersky
 * made available under the MIT License
*/

package graphyx.tests

import sims.dynamics._
import sims.geometry._

object BallStack extends Test{
  val world = new World
  val title = "BallStack"
  def init(): Unit = {
    val ground = new Rectangle(1,0.1,1) {pos = Vector2D(1,0)}
    val wallLeft = new Rectangle(0.1,1,1) {pos = Vector2D(0,1)}
    val wallRight = new Rectangle(0.1,1,1) {pos = Vector2D(2,1)}
    val box = new Body(ground, wallLeft, wallRight) {fixed = true}
    world += box
    world += (new Circle(0.1,1) {pos = Vector2D(1.1, 2.8)}).asBody
    world ++= (for (i <- 0 to 50) yield (new Circle(0.1,1) {pos = Vector2D(1, 3 + 0.2 * i)}).asBody)
    
  }
}