Spit and polish
* New doodad: Invisible Warp Door * All warp doors require the player to be grounded (if affected by gravity) to open them. No jumping or falling thru and opening a warp door mid-air! * Title Screen now randomly selects from a couple of levels. * Title Screen: if it fails to load a level it sets up a basic blank level with a wallpaper instead. * New developer shell command: titlescreen <level> Opens the MainScene with a custom user level as the background. * Add Auto-save to the Editor to save your drawing every 5 minutes * Add a MenuBar to the Play Scene for easier navigation to other features of the game. * Doodad JS API: time.Since() now available.
This commit is contained in:
parent
d8d59fa700
commit
ca9ad6e3a8
|
@ -23,6 +23,11 @@ build:
|
|||
doodad convert -t "Power Source" power-64.png power-source.doodad
|
||||
doodad install-script power.js power-source.doodad
|
||||
|
||||
# Warp Door
|
||||
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 install-script ../warp-door/warp-door.js reg-warp-door.doodad
|
||||
|
||||
for i in *.doodad; do\
|
||||
doodad edit-doodad --tag "category=technical" $${i};\
|
||||
done
|
||||
|
|
BIN
dev-assets/doodads/regions/warp-door-64.png
Normal file
BIN
dev-assets/doodads/regions/warp-door-64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 821 B |
|
@ -17,7 +17,7 @@ build:
|
|||
doodad install-script warp-door.js warp-door-orange.doodad
|
||||
|
||||
for i in *.doodad; do\
|
||||
doodad edit-doodad --tag "category=doors" $${i};\
|
||||
doodad edit-doodad --tag "category=doors" --hitbox=34,76 $${i};\
|
||||
done
|
||||
for i in warp-door-*.doodad; do\
|
||||
doodad edit-doodad --tag "category=doors,gizmos" $${i};\
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
// Warp Doors
|
||||
function main() {
|
||||
Self.SetHitbox(0, 0, 34, 76);
|
||||
|
||||
// Are we a blue or orange door? Regular warp door will be 'none'
|
||||
var color = Self.GetTag("color");
|
||||
var isStateDoor = color === 'blue' || color === 'orange';
|
||||
|
@ -23,6 +21,11 @@ function main() {
|
|||
Self.AddAnimation("close", animSpeed, ["orange-4", "orange-3", "orange-2", "orange-1"]);
|
||||
spriteDefault = "orange-1";
|
||||
spriteDisabled = "orange-off";
|
||||
} else if (color === 'invisible') {
|
||||
// Invisible Warp Door region.
|
||||
Self.Hide();
|
||||
Self.AddAnimation("open", animSpeed, [0, 0]);
|
||||
Self.AddAnimation("close", animSpeed, [0, 0]);
|
||||
} else {
|
||||
Self.AddAnimation("open", animSpeed, ["door-2", "door-3", "door-4"]);
|
||||
Self.AddAnimation("close", animSpeed, ["door-4", "door-3", "door-2", "door-1"]);
|
||||
|
@ -48,6 +51,10 @@ function main() {
|
|||
});
|
||||
}
|
||||
|
||||
// For player groundedness work-around
|
||||
var playerLastY = []; // last sampling of Y values
|
||||
var lastUsed = time.Now();
|
||||
|
||||
// The player Uses the door.
|
||||
var flashedCooldown = false; // "Locked Door" flashed message.
|
||||
Events.OnUse(function(e) {
|
||||
|
@ -74,6 +81,40 @@ function main() {
|
|||
return;
|
||||
}
|
||||
|
||||
// The player must be grounded or have no gravity to open the door.
|
||||
if (!e.Actor.Grounded() && e.Actor.HasGravity()) {
|
||||
// Work-around: if two Boxes are stacked atop each other the player can
|
||||
// get stuck if he jumps on top. He may not be Grounded but isn't changing
|
||||
// effective Y position and a warp door may work as a good way out.
|
||||
var yValue = e.Actor.Position().Y;
|
||||
|
||||
// Collect a sampling of last few Y values. If the player Y position
|
||||
// is constant the last handful of frames, treat them as if they're
|
||||
// grounded (or else they can't activate the warp door).
|
||||
playerLastY.unshift(yValue);
|
||||
if (playerLastY.length < 6) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We have enough history.
|
||||
playerLastY.pop();
|
||||
|
||||
// Hasn't moved?
|
||||
var isGrounded = true;
|
||||
for (var i = 0; i < playerLastY.length; i++) {
|
||||
if (yValue !== playerLastY[i]) {
|
||||
isGrounded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isGrounded) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Player was effectively grounded! No change in Y position.
|
||||
}
|
||||
|
||||
// Freeze the player.
|
||||
e.Actor.Freeze()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user