Noah Petherbridge
3892087932
* The "Use Key" (Q or Spacebar) now activates the Warp Door instead of a collision event doing so. * Warp Doors are now functional: the player opens a door, disappears, the door closes; player is teleported to the linked door which opens, appears the player and closes. * If the player exits thru a Blue or Orange door which is disabled (dotted outline), the door still opens and drops the player off but returns to a Disabled state, acting as a one-way door. * Clean up several debug log lines from Doodle and doodad scripts.
36 lines
576 B
JavaScript
36 lines
576 B
JavaScript
function main() {
|
|
var timer = 0;
|
|
var pressed = false;
|
|
|
|
Events.OnCollide(function(e) {
|
|
if (!e.Settled) {
|
|
return;
|
|
}
|
|
|
|
// Verify they've touched the button.
|
|
if (e.Overlap.Y + e.Overlap.H < 24) {
|
|
return;
|
|
}
|
|
|
|
if (!pressed) {
|
|
Sound.Play("button-down.wav")
|
|
Message.Publish("power", true);
|
|
pressed = true;
|
|
}
|
|
|
|
|
|
if (timer > 0) {
|
|
clearTimeout(timer);
|
|
}
|
|
|
|
Self.ShowLayer(1);
|
|
timer = setTimeout(function() {
|
|
Sound.Play("button-up.wav")
|
|
Self.ShowLayer(0);
|
|
Message.Publish("power", false);
|
|
timer = 0;
|
|
pressed = false;
|
|
}, 200);
|
|
});
|
|
}
|