Anvil and Camera Focus doodads
This commit is contained in:
parent
319e5c0a25
commit
4d960f4d2d
|
@ -14,6 +14,7 @@ function main() {
|
||||||
let nowAt = Self.Position();
|
let nowAt = Self.Position();
|
||||||
if (nowAt.Y > lastPoint.Y) {
|
if (nowAt.Y > lastPoint.Y) {
|
||||||
falling = true;
|
falling = true;
|
||||||
|
Self.CameraFollowMe();
|
||||||
} else {
|
} else {
|
||||||
falling = false;
|
falling = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ build:
|
||||||
doodad convert -t "Power Source" power-64.png power-source.doodad
|
doodad convert -t "Power Source" power-64.png power-source.doodad
|
||||||
doodad install-script power.js power-source.doodad
|
doodad install-script power.js power-source.doodad
|
||||||
|
|
||||||
|
# Look At Me
|
||||||
|
doodad convert -t "Look At Me" camera-focus.png camera-focus.doodad
|
||||||
|
doodad install-script camera-focus.js camera-focus.doodad
|
||||||
|
|
||||||
# Warp Door
|
# Warp Door
|
||||||
doodad convert -t "Invisible Warp Door" warp-door-64.png reg-warp-door.doodad
|
doodad convert -t "Invisible Warp Door" warp-door-64.png reg-warp-door.doodad
|
||||||
doodad edit-doodad --tag "color=invisible" reg-warp-door.doodad
|
doodad edit-doodad --tag "color=invisible" reg-warp-door.doodad
|
||||||
|
|
43
regions/camera-focus.js
Normal file
43
regions/camera-focus.js
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// Camera Region
|
||||||
|
//
|
||||||
|
// When it receives power, it attracts the camera's focus for a while.
|
||||||
|
|
||||||
|
// configuration
|
||||||
|
const ticksToInsist = 24;
|
||||||
|
|
||||||
|
let powered = false;
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
Self.Hide();
|
||||||
|
|
||||||
|
let timer = null;
|
||||||
|
|
||||||
|
Message.Subscribe("power", (v) => {
|
||||||
|
if (powered && !v) {
|
||||||
|
// Lost power, we can do this again next time.
|
||||||
|
powered = false;
|
||||||
|
if (timer !== null) {
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look at me!
|
||||||
|
Self.CameraFollowMe();
|
||||||
|
|
||||||
|
// And insist a while.
|
||||||
|
if (timer === null) {
|
||||||
|
let insistUntil = GetTick() + ticksToInsist;
|
||||||
|
timer = setInterval(() => {
|
||||||
|
if (GetTick() < insistUntil) {
|
||||||
|
Self.CameraFollowMe();
|
||||||
|
} else {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
powered = v;
|
||||||
|
})
|
||||||
|
}
|
BIN
regions/camera-focus.png
Normal file
BIN
regions/camera-focus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 910 B |
Loading…
Reference in New Issue
Block a user