From d8d59fa7005d04bdfa4abdb7b0a54f3db8e569ff Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 12 Oct 2021 20:49:48 -0700 Subject: [PATCH] Condensed Palette, Bird AI Update * The Red Bird now records its original altitude on the level and will try and return there should it accidentally climb up or down a wall. Sometimes goes into a wavy pattern surrounding its original altitude. * Editor UI: in the default (vertical) toolbar, the Palette now has a two column view to show more color choices on screen at once. * User setting added: hide the touch control hints. --- dev-assets/doodads/bird/bird.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dev-assets/doodads/bird/bird.js b/dev-assets/doodads/bird/bird.js index 5d94ebe..c47b628 100644 --- a/dev-assets/doodads/bird/bird.js +++ b/dev-assets/doodads/bird/bird.js @@ -47,10 +47,17 @@ function main() { } sampleTick++; + // If we are not flying at our original altitude, correct for that. + var curV = Self.Position(); + var Vy = 0.0; + if (curV.Y != altitude) { + Vy = curV.Y < altitude ? 1 : -1; + } + // TODO: Vector() requires floats, pain in the butt for JS, // the JS API should be friendlier and custom... var Vx = parseFloat(speed * (direction === "left" ? -1 : 1)); - Self.SetVelocity(Vector(Vx, 0.0)); + Self.SetVelocity(Vector(Vx, Vy)); // If we changed directions, stop animating now so we can // turn around quickly without moonwalking.