75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
////////////////////////////////////////////////////////////////
|
|
function setupGround(){
|
|
ground = Bodies.rectangle(500, 600, 1000, 40, {
|
|
isStatic: true, angle: 0
|
|
});
|
|
World.add(engine.world, [ground]);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
function drawGround(){
|
|
push();
|
|
fill(128);
|
|
drawVertices(ground.vertices);
|
|
pop();
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
function setupPropeller(){
|
|
// your code here
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
//updates and draws the propeller
|
|
function drawPropeller(){
|
|
push();
|
|
// your code here
|
|
pop();
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
function setupBird(){
|
|
var bird = Bodies.circle(mouseX, mouseY, 20, {friction: 0,
|
|
restitution: 0.95 });
|
|
Matter.Body.setMass(bird, bird.mass*10);
|
|
World.add(engine.world, [bird]);
|
|
birds.push(bird);
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
function drawBirds(){
|
|
push();
|
|
//your code here
|
|
pop();
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
//creates a tower of boxes
|
|
function setupTower(){
|
|
//you code here
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
//draws tower of boxes
|
|
function drawTower(){
|
|
push();
|
|
//your code here
|
|
pop();
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
function setupSlingshot(){
|
|
//your code here
|
|
}
|
|
////////////////////////////////////////////////////////////////
|
|
//draws slingshot bird and its constraint
|
|
function drawSlingshot(){
|
|
push();
|
|
// your code here
|
|
pop();
|
|
}
|
|
/////////////////////////////////////////////////////////////////
|
|
function setupMouseInteraction(){
|
|
var mouse = Mouse.create(canvas.elt);
|
|
var mouseParams = {
|
|
mouse: mouse,
|
|
constraint: { stiffness: 0.05 }
|
|
}
|
|
mouseConstraint = MouseConstraint.create(engine, mouseParams);
|
|
mouseConstraint.mouse.pixelRatio = pixelDensity();
|
|
World.add(engine.world, mouseConstraint);
|
|
}
|