Angry Birds Game
(Part I)
Sketch.js:
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
var engine, world;
var box1;
function setup() {
createCanvas(400, 400);
engine = Engine.create();
world = engine.world;
box1 = new Box(200, 150, 50, 50, 'yellow');
box2 = new Box(230, 20, 50, 100);
ground = new Ground(200, 390, 400, 20);
}
function draw() {
background(0);
Engine.update(engine);
box1.display();
box2.display();
ground.display();
}
0 Comments: