33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
// isokit/people: standing and seated figures, small groups.
|
|
|
|
fn people_colours() { ["hivis", "guest1", "guest2", "guest3", "guest4", "guide", "suit"] }
|
|
|
|
fn meta_person() {
|
|
#{ label: "Person", category: "People", icon: "🧍",
|
|
props: [
|
|
#{ key: "cls", type: "choice", def: "hivis", choices: people_colours(), label: "Clothes" },
|
|
#{ key: "seated", type: "bool", def: false, label: "Seated" },
|
|
] }
|
|
}
|
|
fn prefab_person(o) {
|
|
let s = sprite();
|
|
if o.p.seated { s.sit(0.0, 0.0, 0.0, o.p.cls); } else { s.person(0.0, 0.0, 0.0, o.p.cls); }
|
|
}
|
|
|
|
fn meta_crowd() {
|
|
#{ label: "Crowd", category: "People", icon: "👥",
|
|
props: [
|
|
#{ key: "n", type: "int", def: 5, min: 2, max: 40, step: 1, label: "People" },
|
|
#{ key: "r", type: "float", def: 2.0, min: 0.6, max: 15.0, step: 0.1, label: "Spread (m)" },
|
|
] }
|
|
}
|
|
fn prefab_crowd(o) {
|
|
let cols = ["guest1", "guest2", "guest3", "guest4", "hivis"];
|
|
for i in 0..o.p.n {
|
|
// one sprite each, scattered deterministically in a disc
|
|
let a = hash(i * 1.7 + o.x) * 6.2832;
|
|
let r = o.p.r * hash(i * 3.3 + o.y).sqrt();
|
|
sprite().person(r * a.cos(), r * a.sin(), 0.0, cols[i % 5]);
|
|
}
|
|
}
|