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.
|
@ -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 ..
|
||||
}
|
||||
|
||||
|
|
BIN
dev-assets/doodads/doors/blue-closed.png
Normal file
After Width: | Height: | Size: 880 B |
BIN
dev-assets/doodads/doors/blue-left.png
Normal file
After Width: | Height: | Size: 841 B |
BIN
dev-assets/doodads/doors/blue-right.png
Normal file
After Width: | Height: | Size: 841 B |
48
dev-assets/doodads/doors/build.sh
Executable 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/
|
56
dev-assets/doodads/doors/colored-door.js
Normal 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;
|
||||
});
|
||||
}
|
BIN
dev-assets/doodads/doors/green-closed.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
dev-assets/doodads/doors/green-left.png
Normal file
After Width: | Height: | Size: 837 B |
BIN
dev-assets/doodads/doors/green-right.png
Normal file
After Width: | Height: | Size: 836 B |
|
@ -1,3 +1,4 @@
|
|||
// DEPRECATED: old locked door script. Superceded by colored-door.js.
|
||||
function main() {
|
||||
Self.AddAnimation("open", 0, [1]);
|
||||
var unlocked = false;
|
||||
|
|
BIN
dev-assets/doodads/doors/red-closed.png
Normal file
After Width: | Height: | Size: 816 B |
BIN
dev-assets/doodads/doors/red-left.png
Normal file
After Width: | Height: | Size: 846 B |
BIN
dev-assets/doodads/doors/red-right.png
Normal file
After Width: | Height: | Size: 848 B |
BIN
dev-assets/doodads/doors/yellow-closed.png
Normal file
After Width: | Height: | Size: 851 B |
BIN
dev-assets/doodads/doors/yellow-left.png
Normal file
After Width: | Height: | Size: 855 B |
BIN
dev-assets/doodads/doors/yellow-right.png
Normal file
After Width: | Height: | Size: 850 B |