Colorize obstacles in scenes 2 and 3
This commit is contained in:
33
scenes.js
33
scenes.js
@@ -72,20 +72,30 @@
|
||||
Bodies.rectangle(w / 2, h + 50, w, 100, {
|
||||
isStatic: true,
|
||||
restitution: 0.9,
|
||||
render: { fillStyle: "#0ea5e9", strokeStyle: "#0ea5e9" },
|
||||
}),
|
||||
Bodies.rectangle(-50, h / 2, 100, h * 2, {
|
||||
isStatic: true,
|
||||
render: { fillStyle: "#fb7185", strokeStyle: "#fb7185" },
|
||||
}),
|
||||
Bodies.rectangle(w + 50, h / 2, 100, h * 2, {
|
||||
isStatic: true,
|
||||
render: { fillStyle: "#fb7185", strokeStyle: "#fb7185" },
|
||||
}),
|
||||
Bodies.rectangle(-50, h / 2, 100, h * 2, { isStatic: true }),
|
||||
Bodies.rectangle(w + 50, h / 2, 100, h * 2, { isStatic: true }),
|
||||
Bodies.rectangle(w * 0.2, h * 0.45, 200, 18, {
|
||||
isStatic: true,
|
||||
angle: 0.08,
|
||||
render: { fillStyle: "#fbbf24", strokeStyle: "#fbbf24" },
|
||||
}),
|
||||
Bodies.rectangle(w * 0.5, h * 0.6, 260, 18, {
|
||||
isStatic: true,
|
||||
angle: -0.04,
|
||||
render: { fillStyle: "#34d399", strokeStyle: "#34d399" },
|
||||
}),
|
||||
Bodies.rectangle(w * 0.8, h * 0.42, 180, 18, {
|
||||
isStatic: true,
|
||||
angle: 0.14,
|
||||
render: { fillStyle: "#38bdf8", strokeStyle: "#38bdf8" },
|
||||
}),
|
||||
],
|
||||
},
|
||||
@@ -113,25 +123,38 @@
|
||||
Bodies.rectangle(w / 2, h + 40, w, 80, {
|
||||
isStatic: true,
|
||||
restitution: 0.75,
|
||||
render: { fillStyle: "#0ea5e9", strokeStyle: "#0ea5e9" },
|
||||
}),
|
||||
Bodies.rectangle(-40, h / 2, 80, h * 2, {
|
||||
isStatic: true,
|
||||
render: { fillStyle: "#e879f9", strokeStyle: "#e879f9" },
|
||||
}),
|
||||
Bodies.rectangle(w + 40, h / 2, 80, h * 2, {
|
||||
isStatic: true,
|
||||
render: { fillStyle: "#e879f9", strokeStyle: "#e879f9" },
|
||||
}),
|
||||
Bodies.rectangle(-40, h / 2, 80, h * 2, { isStatic: true }),
|
||||
Bodies.rectangle(w + 40, h / 2, 80, h * 2, { isStatic: true }),
|
||||
];
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
const x = (w * (i + 1)) / 6;
|
||||
const y = h * 0.35 + (i % 2 === 0 ? 40 : -30);
|
||||
bodies.push(
|
||||
Bodies.circle(x, y, 18, { isStatic: true, restitution: 0.9 }),
|
||||
Bodies.circle(x, y, 18, {
|
||||
isStatic: true,
|
||||
restitution: 0.9,
|
||||
render: { fillStyle: "#f97316", strokeStyle: "#f97316" },
|
||||
}),
|
||||
);
|
||||
}
|
||||
bodies.push(
|
||||
Bodies.rectangle(w * 0.3, h * 0.55, 140, 16, {
|
||||
isStatic: true,
|
||||
angle: -0.3,
|
||||
render: { fillStyle: "#38bdf8", strokeStyle: "#38bdf8" },
|
||||
}),
|
||||
Bodies.rectangle(w * 0.7, h * 0.58, 160, 16, {
|
||||
isStatic: true,
|
||||
angle: 0.28,
|
||||
render: { fillStyle: "#22c55e", strokeStyle: "#22c55e" },
|
||||
}),
|
||||
);
|
||||
return bodies;
|
||||
|
||||
Reference in New Issue
Block a user