2019-04-19 01:15:05 +00:00
|
|
|
function main() {
|
|
|
|
console.log("%s initialized!", Self.Doodad.Title);
|
|
|
|
|
|
|
|
var timer = 0;
|
|
|
|
|
2019-06-09 00:02:28 +00:00
|
|
|
Self.SetHitbox(0, 0, 72, 6);
|
2019-05-29 04:43:30 +00:00
|
|
|
|
2019-05-05 23:32:30 +00:00
|
|
|
var animationSpeed = 100;
|
2019-05-07 05:57:32 +00:00
|
|
|
var opened = false;
|
2019-05-05 23:32:30 +00:00
|
|
|
Self.AddAnimation("open", animationSpeed, ["down1", "down2", "down3", "down4"]);
|
|
|
|
Self.AddAnimation("close", animationSpeed, ["down4", "down3", "down2", "down1"]);
|
2019-04-19 01:15:05 +00:00
|
|
|
|
2019-05-07 05:57:32 +00:00
|
|
|
Events.OnCollide( function(e) {
|
|
|
|
if (opened) {
|
2019-04-19 01:15:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-05-29 04:43:30 +00:00
|
|
|
// Is the actor colliding our solid part?
|
|
|
|
if (e.InHitbox) {
|
|
|
|
// Touching the top or the bottom?
|
|
|
|
if (e.Overlap.Y > 0) {
|
|
|
|
return false; // solid wall when touched from below
|
|
|
|
} else {
|
|
|
|
opened = true;
|
|
|
|
Self.PlayAnimation("open", function() {
|
|
|
|
});
|
|
|
|
}
|
2019-05-07 05:57:32 +00:00
|
|
|
}
|
2019-05-05 23:32:30 +00:00
|
|
|
});
|
2019-05-29 04:43:30 +00:00
|
|
|
|
2019-05-07 05:57:32 +00:00
|
|
|
Events.OnLeave(function() {
|
2019-05-29 04:43:30 +00:00
|
|
|
if (opened) {
|
|
|
|
Self.PlayAnimation("close", function() {
|
|
|
|
opened = false;
|
|
|
|
});
|
|
|
|
}
|
2019-05-07 05:57:32 +00:00
|
|
|
})
|
2019-04-19 01:15:05 +00:00
|
|
|
}
|