Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created January 18, 2012 19:58
Show Gist options
  • Save apeckham/1635181 to your computer and use it in GitHub Desktop.
Save apeckham/1635181 to your computer and use it in GitHub Desktop.
solution to level 2 on peanutty.org
Peanutty.loadLevel()
peanutty.createBall
x: 203.94690265486724
y: 509.8672566371681
radius: 20
static: true
peanutty.wait(440)
peanutty.createBall
x: 229.44026548672565
y: 510.9756637168141
radius: 20
static: true
peanutty.wait(266)
peanutty.createBall
x: 258.2588495575221
y: 513.1924778761062
radius: 20
static: true
peanutty.wait(267)
peanutty.createBall
x: 279.3185840707965
y: 513.1924778761062
radius: 20
static: true
peanutty.wait(260)
peanutty.createBall
x: 304.8119469026549
y: 510.9756637168141
radius: 20
static: true
peanutty.wait(276)
peanutty.createBall
x: 328.08849557522126
y: 506.54203539823004
radius: 20
static: true
peanutty.wait(264)
peanutty.createBall
x: 346.9314159292035
y: 503.21681415929197
radius: 20
static: true
peanutty.wait(235)
peanutty.createBall
x: 370.2079646017699
y: 497.67477876106193
radius: 20
static: true
peanutty.wait(266)
peanutty.createBall
x: 395.7013274336283
y: 494.34955752212386
radius: 20
static: true
peanutty.wait(332)
peanutty.createBall
x: 414.54424778761063
y: 489.9159292035398
radius: 20
static: true
cannonball = peanutty.createBall
x: 125
y: 133
radius: 10
density: 50
drawData: {color: new b2d.Common.b2Color(0.1, 0.1, 0.1), alpha: 0.8}
angle = 60
force = 50
x = Math.cos(Math.PI/(180 / angle)) * force
y = -1 * Math.sin(Math.PI/(180 / angle)) * force
cannonball.SetLinearVelocity(new b2d.Common.Math.b2Vec2(x,y))
peanutty.createPoly
path: [{x: 544.2278761061947, y: 495.4579646017699},{x: 739.3075221238938, y: 484.37389380530976},{x: 708.2721238938053, y: 285.96902654867256}]
static: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment