Update changed puph pop to vertex shape
This commit is contained in:
@ -22,18 +22,19 @@ function setup() {
|
|||||||
function draw() {
|
function draw() {
|
||||||
background(0);
|
background(0);
|
||||||
Engine.update(engine);
|
Engine.update(engine);
|
||||||
rectMode(CENTER);
|
|
||||||
push();
|
|
||||||
let pos = box1.position;
|
|
||||||
translate(pos.x, pos.y);
|
|
||||||
rotate(box1.angle);
|
|
||||||
rect(0, 0, 80, 80);
|
|
||||||
pop();
|
|
||||||
|
|
||||||
push();
|
fill(255);
|
||||||
pos = ground.position;
|
drawVertices(box1.vertices);
|
||||||
translate(pos.x, pos.y);
|
|
||||||
rotate(ground.angle);
|
fill(150, 50, 50);
|
||||||
rect(0, 0, 810, 10);
|
drawVertices(ground.vertices);
|
||||||
pop();
|
}
|
||||||
|
|
||||||
|
function drawVertices(vertices)
|
||||||
|
{
|
||||||
|
beginShape();
|
||||||
|
for (let i = 0; i < vertices.length; i++) {
|
||||||
|
vertex(vertices[i].x, vertices[i].y);
|
||||||
|
}
|
||||||
|
endShape();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user