WIP: MsgPack stubs, Level Filesystem Module

* Add some encoding/decoding functions for binary msgpack format for
  levels and doodads. Currently it writes msgpack files that can be
  decoded and printed by Python (mp2json.py) but it can't re-read from
  the binary format. For now, levels will continue to write in JSON
  format.
* Add filesystem abstraction functions to the balance/ package to search
  multiple paths to find Levels and Doodads, to make way for
  system-level doodads.
master
Noah 2019-05-05 14:03:20 -07:00
parent 16e8937f0f
commit 1f0075b0f2
1 changed files with 49 additions and 1 deletions

View File

@ -1,4 +1,52 @@
function main() {
log.Info("Azulian '%s' initialized!", Self.Doodad.Title);
Self.ShowLayer(2);
var playerSpeed = 12;
var gravity = 4;
var Vx = Vy = 0;
var animating = false;
var animStart = animEnd = 0;
var animFrame = animStart;
setInterval(function() {
if (animating) {
if (animFrame < animStart || animFrame > animEnd) {
animFrame = animStart;
}
animFrame++;
if (animFrame === animEnd) {
animFrame = animStart;
}
Self.ShowLayer(animFrame);
} else {
Self.ShowLayer(animStart);
}
}, 100);
Events.OnKeypress(function(ev) {
Vx = 0;
Vy = 0;
if (ev.Right.Now) {
animStart = 2;
animEnd = animStart+4;
animating = true;
Vx = playerSpeed;
} else if (ev.Left.Now) {
animStart = 6;
animEnd = animStart+4;
animating = true;
Vx = -playerSpeed;
} else {
animating = false;
}
if (!Self.Grounded()) {
Vy += gravity;
}
// Self.SetVelocity(Point(Vx, Vy));
})
}