Thanks for the great examples!
Unfortunately I'm aiming for a different look (top down isometric), with different constraints:
- The background isn't a flat color, but rather a bitmap
- The entities are bitmaps / sprites
- The shadows are also bitmap / sprites, BUT are different from the entities themselves
here's a sample code (can be tested in the editor) that demonstrates the required look and the shadow issue (i'm not sure how to share it in the editor):
// Given F, S, W, H or frame, stage, stageW, stageH
// assume background is a bitmap, and not a flat color
const gradient = new GradientColor(['#FF0', '#F8F'], [0,1], 0,0, 0,H);
const bg = new Rectangle(W, H, gradient);
S.addChild(bg);
// shadowsLayer - shadows are bitmaps/sprites, different from entities
const shadowsLayer = new Container().ble('normal').alp(0.5);
S.addChild(shadowsLayer);
// entitiesLayer - entities are bitmaps/sprites, different from shadows
const entitiesLayer = new Container();
S.addChild(entitiesLayer);
// add entities and shadows
const data = [
{ x: 128, y: 256, tc: 'red', fc: 'darkred' },
{ x: 128, y: 192, tc: 'green', fc: 'darkgreen' },
{ x: 64, y: 192, tc: 'blue', fc: 'darkblue' },
{ x: 32, y: 32, tc: 'red', fc: 'darkred' },
];
// assume their position is updated
data.forEach((data) => {
// entity
const entity = new Container();
const top = new Rectangle(64, 64, data.tc).addTo(entity).loc(0, -16);
const front = new Rectangle(64, 16, data.fc).addTo(entity).loc(0, 48);
entitiesLayer.addChild(entity);
entity.x = data.x;
entity.y = data.y;
// shadow
const shadow = new Shape().f('black').mt(0, 0).lt(64, 0).lt(80, 16).lt(80, 80).lt(16, 80).lt(0, 64).ef();
shadowsLayer.addChild(shadow);
shadow.x = data.x;
shadow.y = data.y;
});
S.update();
Appreciate any help with that