New (Colored) Locked Door Doodads

* Revamped the sprites for the four colored locked doors. They now have
  a side-view profile perspective rather than a front view.
* Doors open facing the left or the right based on what direction the
  colliding actor approached it from.
This commit is contained in:
Noah 2020-04-02 21:43:41 -07:00
parent f8ca9a0921
commit 3cb99ad5f8
17 changed files with 107 additions and 39 deletions

View File

@ -43,44 +43,7 @@ switches() {
doors() {
cd doors/
doodad convert -t "Red Door" red1.png red2.png door-red.doodad
doodad edit-doodad -q --tag color=red door-red.doodad
doodad install-script locked-door.js door-red.doodad
doodad convert -t "Blue Door" blue1.png blue2.png door-blue.doodad
doodad edit-doodad -q --tag color=blue door-blue.doodad
doodad install-script locked-door.js door-blue.doodad
doodad convert -t "Green Door" green1.png green2.png door-green.doodad
doodad edit-doodad -q --tag color=green door-green.doodad
doodad install-script locked-door.js door-green.doodad
doodad convert -t "Yellow Door" yellow1.png yellow2.png door-yellow.doodad
doodad edit-doodad -q --tag color=yellow door-yellow.doodad
doodad install-script locked-door.js door-yellow.doodad
doodad convert -t "Red Key" red-key.png key-red.doodad
doodad edit-doodad -q --tag color=red key-red.doodad
doodad install-script keys.js key-red.doodad
doodad convert -t "Blue Key" blue-key.png key-blue.doodad
doodad edit-doodad -q --tag color=blue key-blue.doodad
doodad install-script keys.js key-blue.doodad
doodad convert -t "Green Key" green-key.png key-green.doodad
doodad edit-doodad -q --tag color=green key-green.doodad
doodad install-script keys.js key-green.doodad
doodad convert -t "Yellow Key" yellow-key.png key-yellow.doodad
doodad edit-doodad -q --tag color=yellow key-yellow.doodad
doodad install-script keys.js key-yellow.doodad
doodad convert -t "Electric Door" electric{1,2,3,4}.png door-electric.doodad
doodad install-script electric-door.js door-electric.doodad
cp door-*.doodad key-*.doodad ../../../assets/doodads/
./build.sh
cd ..
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

View File

@ -0,0 +1,48 @@
# doodad convert -t "Red Door" red1.png red2.png door-red.doodad
# doodad edit-doodad -q --tag color=red door-red.doodad
# doodad install-script locked-door.js door-red.doodad
doodad convert -t "Red Door" red-closed.png red-right.png red-left.png door-red.doodad
doodad edit-doodad -q --tag color=red door-red.doodad
doodad install-script colored-door.js door-red.doodad
doodad convert -t "Blue Door" blue-closed.png blue-right.png blue-left.png door-blue.doodad
doodad edit-doodad -q --tag color=blue door-blue.doodad
doodad install-script colored-door.js door-blue.doodad
doodad convert -t "Green Door" green-closed.png green-right.png green-left.png door-green.doodad
doodad edit-doodad -q --tag color=green door-green.doodad
doodad install-script colored-door.js door-green.doodad
doodad convert -t "Yellow Door" yellow-closed.png yellow-right.png yellow-left.png door-yellow.doodad
doodad edit-doodad -q --tag color=yellow door-yellow.doodad
doodad install-script colored-door.js door-yellow.doodad
# doodad convert -t "Green Door" green1.png green2.png door-green.doodad
# doodad edit-doodad -q --tag color=green door-green.doodad
# doodad install-script locked-door.js door-green.doodad
#
# doodad convert -t "Yellow Door" yellow1.png yellow2.png door-yellow.doodad
# doodad edit-doodad -q --tag color=yellow door-yellow.doodad
# doodad install-script locked-door.js door-yellow.doodad
doodad convert -t "Red Key" red-key.png key-red.doodad
doodad edit-doodad -q --tag color=red key-red.doodad
doodad install-script keys.js key-red.doodad
doodad convert -t "Blue Key" blue-key.png key-blue.doodad
doodad edit-doodad -q --tag color=blue key-blue.doodad
doodad install-script keys.js key-blue.doodad
doodad convert -t "Green Key" green-key.png key-green.doodad
doodad edit-doodad -q --tag color=green key-green.doodad
doodad install-script keys.js key-green.doodad
doodad convert -t "Yellow Key" yellow-key.png key-yellow.doodad
doodad edit-doodad -q --tag color=yellow key-yellow.doodad
doodad install-script keys.js key-yellow.doodad
doodad convert -t "Electric Door" electric{1,2,3,4}.png door-electric.doodad
doodad install-script electric-door.js door-electric.doodad
cp door-*.doodad key-*.doodad ../../../assets/doodads/

View File

@ -0,0 +1,56 @@
function main() {
var color = Self.Doodad.Tag("color");
// Layers in the doodad image.
var layer = {
closed: 0,
right: 1,
left: 2,
};
// Variables that change in event handler.
var unlocked = false; // Key has been used to unlock the door (one time).
var opened = false; // If door is currently showing its opened state.
var enterSide = 0; // Side of player entering the door, -1 or 1, left or right.
Self.SetHitbox(23, 0, 23, 64);
Events.OnCollide(function(e) {
// Record the side that this actor has touched us, in case the door
// needs to open.
if (enterSide === 0) {
enterSide = e.Overlap.X > 0 ? 1 : -1;
}
if (opened) {
return;
}
if (e.InHitbox) {
if (unlocked) {
Self.ShowLayer(enterSide < 0 ? layer.right : layer.left);
opened = true;
return;
}
var data = e.Actor.GetData("key:" + color);
if (data === "") {
// Door is locked.
return false;
}
if (e.Settled) {
unlocked = true;
Self.ShowLayer(enterSide < 0 ? layer.right : layer.left);
}
}
});
Events.OnLeave(function(e) {
Self.ShowLayer(layer.closed);
// Reset collision state.
opened = false;
enterSide = 0;
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

View File

@ -1,3 +1,4 @@
// DEPRECATED: old locked door script. Superceded by colored-door.js.
function main() {
Self.AddAnimation("open", 0, [1]);
var unlocked = false;

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View File

@ -14,7 +14,7 @@ var (
ScrollboxVert = 128
// Player speeds
PlayerMaxVelocity = 10
PlayerMaxVelocity = 6
PlayerAcceleration = 2
Gravity = 6