doodle/dev-assets/doodads/mischievous.js
Noah Petherbridge 08e65c32b5 Overhaul the Platformer Physics System
* Player character now experiences acceleration and friction when
  walking around the map!
* Actor position and movement had to be converted from int's
  (render.Point) to float64's to support fine-grained acceleration
  steps.
* Added "physics" package and physics.Vector to be a float64 counterpart
  for render.Point. Vector is used for uix.Actor.Position() for the sake
  of movement math. Vector is flattened back to a render.Point for
  collision purposes, since the levels and hitboxes are pixel-bound.
* Refactor the uix.Actor to no longer extend the doodads.Drawing (so it
  can have a Position that's a Vector instead of a Point). This broke
  some code that expected `.Doodad` to directly reference the
  Drawing.Doodad: now you had to refer to it as `a.Drawing.Doodad` which
  was ugly. Added convenience method .Doodad() for a shortcut.
* Moved functions like GetBoundingRect() from doodads package to
  collision, where it uses its own slimmer Actor interface for just the
  relevant methods it needs.
2020-04-04 21:00:32 -07:00

44 lines
1.1 KiB
JavaScript

function main() {
console.log("%s initialized!", Self.Doodad().Title);
console.log(Object.keys(console));
console.log(Object.keys(log));
console.log(Object.keys(log.Config));
console.log(Object.keys(Self.Canvas.Palette));
console.log(Object.keys(Self.Canvas.Palette.Swatches[0]));
Self.Canvas.Palette.Swatches[0].Color = RGBA(255, 0, 255, 255);
Self.Canvas.Palette.Swatches[1].Color = RGBA(0, 255, 255, 255);
console.log(Self.Canvas.Palette.Swatches);
log.Config.TimeFormat = "haha";
var colors = [
RGBA(255, 0, 0, 255),
RGBA(255, 153, 0, 255),
RGBA(255, 255, 0, 255),
RGBA(0, 255, 0, 255),
RGBA(0, 153, 255, 255),
RGBA(0, 0, 255, 255),
RGBA(255, 0, 255, 255)
];
var colorIndex = 0;
setInterval(function() {
console.log("sticky tick");
Self.Canvas.MaskColor = colors[colorIndex];
colorIndex++;
if (colorIndex == colors.length) {
colorIndex = 0;
}
}, 100);
// log.Config.Colors = 0; // panics, can't set a golog.Color
Events.OnCollide( function() {
Self.ShowLayer(1);
setTimeout(function() {
Self.ShowLayer(0);
}, 200);
})
}