commit ac31d942bcc914493d08cd6018da6aea6c603199 Author: Noah Petherbridge Date: Sun Oct 3 22:01:41 2021 -0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d2ae1fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.doodad diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..d8202b4 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,4 @@ +# Sketchy Maze Assets + +All assets in this repository are copyright (C) 2021 Noah Petherbridge. +All rights reserved. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0059e6d --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Sketchy Maze Assets + +This repo contains the game's built-in artwork (doodads and levels). The +assets here are licensed separately from the game's source code. + +The contents of this repository is copyright (C) 2021 Noah Petherbridge. +All rights reserved. Not for redistribution outside of official builds of +Sketchy Maze. + +## Doodads + +The doodads are in source form (png's and scripts) and need compiling. +They'll write and copy their outputs to "./assets/doodads" relative to +the root of this git repo. + +Make sure the `doodad` program is on your $PATH and the build.sh script +will compile all the doodads. diff --git a/doodads/azulian/Makefile b/doodads/azulian/Makefile new file mode 100644 index 0000000..1fde043 --- /dev/null +++ b/doodads/azulian/Makefile @@ -0,0 +1,22 @@ +SHELL = /bin/bash + +ALL: build + +.PHONY: build +build: + doodad convert -t "Blue Azulian" blu-front.png blu-back.png \ + blu-wr{1,2,3,4}.png blu-wl{1,2,3,4}.png azu-blu.doodad + doodad edit-doodad --tag "color=blue" azu-blu.doodad + doodad install-script azulian.js azu-blu.doodad + + doodad convert -t "Red Azulian" red-front.png red-back.png \ + red-wr{1,2,3,4}.png red-wl{1,2,3,4}.png azu-red.doodad + doodad edit-doodad --tag "color=red" azu-red.doodad + doodad install-script azulian.js azu-red.doodad + + # Tag the category for these doodads + for i in *.doodad; do\ + doodad edit-doodad --tag "category=creatures" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ diff --git a/doodads/azulian/azulian-red.js b/doodads/azulian/azulian-red.js new file mode 100644 index 0000000..aeb5f91 --- /dev/null +++ b/doodads/azulian/azulian-red.js @@ -0,0 +1,43 @@ +// Azulian (Red) +// DEPRECATED: they both share azulian.js now. + +function main() { + var playerSpeed = 4; + var gravity = 4; + var Vx = Vy = 0; + + var direction = "right"; + + Self.SetHitbox(0, 0, 32, 32) + Self.SetMobile(true); + Self.SetInventory(true); + Self.SetGravity(true); + Self.AddAnimation("walk-left", 100, ["red-wl1", "red-wl2", "red-wl3", "red-wl4"]); + Self.AddAnimation("walk-right", 100, ["red-wr1", "red-wr2", "red-wr3", "red-wr4"]); + + // Sample our X position every few frames and detect if we've hit a solid wall. + var sampleTick = 0; + var sampleRate = 5; + var lastSampledX = 0; + + setInterval(function () { + if (sampleTick % sampleRate === 0) { + var curX = Self.Position().X; + var delta = Math.abs(curX - lastSampledX); + if (delta < 5) { + direction = direction === "right" ? "left" : "right"; + } + lastSampledX = curX; + } + sampleTick++; + + // TODO: Vector() requires floats, pain in the butt for JS, + // the JS API should be friendlier and custom... + var Vx = parseFloat(playerSpeed * (direction === "left" ? -1 : 1)); + Self.SetVelocity(Vector(Vx, 0.0)); + + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-" + direction, null); + } + }, 100); +} diff --git a/doodads/azulian/azulian.js b/doodads/azulian/azulian.js new file mode 100644 index 0000000..bd63b64 --- /dev/null +++ b/doodads/azulian/azulian.js @@ -0,0 +1,83 @@ +// Azulian (Red and Blue) +var playerSpeed = 12, + animating = false, + direction = "right", + lastDirection = "right"; + +function setupAnimations(color) { + var left = color === 'blue' ? 'blu-wl' : 'red-wl', + right = color === 'blue' ? 'blu-wr' : 'red-wr', + leftFrames = [left + '1', left + '2', left + '3', left + '4'], + rightFrames = [right + '1', right + '2', right + '3', right + '4']; + + Self.AddAnimation("walk-left", 100, leftFrames); + Self.AddAnimation("walk-right", 100, rightFrames); +} + +function main() { + var color = Self.GetTag("color"); + playerSpeed = color === 'blue' ? 2 : 4; + + Self.SetMobile(true); + Self.SetGravity(true); + Self.SetInventory(true); + Self.SetHitbox(0, 0, 24, 32); + setupAnimations(color); + + if (Self.IsPlayer()) { + return playerControls(); + } + + // A.I. pattern: walks back and forth, turning around + // when it meets resistance. + + // Sample our X position every few frames and detect if we've hit a solid wall. + var sampleTick = 0; + var sampleRate = 5; + var lastSampledX = 0; + + setInterval(function () { + if (sampleTick % sampleRate === 0) { + var curX = Self.Position().X; + var delta = Math.abs(curX - lastSampledX); + if (delta < 5) { + direction = direction === "right" ? "left" : "right"; + } + lastSampledX = curX; + } + sampleTick++; + + var Vx = parseFloat(playerSpeed * (direction === "left" ? -1 : 1)); + Self.SetVelocity(Vector(Vx, 0.0)); + + // If we changed directions, stop animating now so we can + // turn around quickly without moonwalking. + if (direction !== lastDirection) { + Self.StopAnimation(); + } + + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-" + direction, null); + } + + lastDirection = direction; + }, 100); +} + +function playerControls() { + // Note: player speed is controlled by the engine. + Events.OnKeypress(function (ev) { + if (ev.Right) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-right", null); + } + } else if (ev.Left) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-left", null); + } + } else { + Self.StopAnimation(); + animating = false; + } + }) +} diff --git a/doodads/azulian/blu-back.png b/doodads/azulian/blu-back.png new file mode 100644 index 0000000..066eaa1 Binary files /dev/null and b/doodads/azulian/blu-back.png differ diff --git a/doodads/azulian/blu-front.png b/doodads/azulian/blu-front.png new file mode 100644 index 0000000..8f22c99 Binary files /dev/null and b/doodads/azulian/blu-front.png differ diff --git a/doodads/azulian/blu-wl1.png b/doodads/azulian/blu-wl1.png new file mode 100644 index 0000000..a97706b Binary files /dev/null and b/doodads/azulian/blu-wl1.png differ diff --git a/doodads/azulian/blu-wl2.png b/doodads/azulian/blu-wl2.png new file mode 100644 index 0000000..aabb1fd Binary files /dev/null and b/doodads/azulian/blu-wl2.png differ diff --git a/doodads/azulian/blu-wl3.png b/doodads/azulian/blu-wl3.png new file mode 100644 index 0000000..428e733 Binary files /dev/null and b/doodads/azulian/blu-wl3.png differ diff --git a/doodads/azulian/blu-wl4.png b/doodads/azulian/blu-wl4.png new file mode 100644 index 0000000..05079b3 Binary files /dev/null and b/doodads/azulian/blu-wl4.png differ diff --git a/doodads/azulian/blu-wr1.png b/doodads/azulian/blu-wr1.png new file mode 100644 index 0000000..f4e1945 Binary files /dev/null and b/doodads/azulian/blu-wr1.png differ diff --git a/doodads/azulian/blu-wr2.png b/doodads/azulian/blu-wr2.png new file mode 100644 index 0000000..3044546 Binary files /dev/null and b/doodads/azulian/blu-wr2.png differ diff --git a/doodads/azulian/blu-wr3.png b/doodads/azulian/blu-wr3.png new file mode 100644 index 0000000..5581c13 Binary files /dev/null and b/doodads/azulian/blu-wr3.png differ diff --git a/doodads/azulian/blu-wr4.png b/doodads/azulian/blu-wr4.png new file mode 100644 index 0000000..4f43114 Binary files /dev/null and b/doodads/azulian/blu-wr4.png differ diff --git a/doodads/azulian/red-back.png b/doodads/azulian/red-back.png new file mode 100644 index 0000000..2f5d2ef Binary files /dev/null and b/doodads/azulian/red-back.png differ diff --git a/doodads/azulian/red-front.png b/doodads/azulian/red-front.png new file mode 100644 index 0000000..8e7b797 Binary files /dev/null and b/doodads/azulian/red-front.png differ diff --git a/doodads/azulian/red-wl1.png b/doodads/azulian/red-wl1.png new file mode 100644 index 0000000..a05f987 Binary files /dev/null and b/doodads/azulian/red-wl1.png differ diff --git a/doodads/azulian/red-wl2.png b/doodads/azulian/red-wl2.png new file mode 100644 index 0000000..a4f7468 Binary files /dev/null and b/doodads/azulian/red-wl2.png differ diff --git a/doodads/azulian/red-wl3.png b/doodads/azulian/red-wl3.png new file mode 100644 index 0000000..00c776d Binary files /dev/null and b/doodads/azulian/red-wl3.png differ diff --git a/doodads/azulian/red-wl4.png b/doodads/azulian/red-wl4.png new file mode 100644 index 0000000..9b0c599 Binary files /dev/null and b/doodads/azulian/red-wl4.png differ diff --git a/doodads/azulian/red-wr1.png b/doodads/azulian/red-wr1.png new file mode 100644 index 0000000..dfcfffe Binary files /dev/null and b/doodads/azulian/red-wr1.png differ diff --git a/doodads/azulian/red-wr2.png b/doodads/azulian/red-wr2.png new file mode 100644 index 0000000..a79f3a3 Binary files /dev/null and b/doodads/azulian/red-wr2.png differ diff --git a/doodads/azulian/red-wr3.png b/doodads/azulian/red-wr3.png new file mode 100644 index 0000000..5e79c36 Binary files /dev/null and b/doodads/azulian/red-wr3.png differ diff --git a/doodads/azulian/red-wr4.png b/doodads/azulian/red-wr4.png new file mode 100644 index 0000000..219ec34 Binary files /dev/null and b/doodads/azulian/red-wr4.png differ diff --git a/doodads/bird/Makefile b/doodads/bird/Makefile new file mode 100644 index 0000000..e70fedc --- /dev/null +++ b/doodads/bird/Makefile @@ -0,0 +1,14 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Bird (red)" left-1.png left-2.png right-1.png right-2.png \ + dive-left.png dive-right.png bird-red.doodad + doodad install-script bird.js bird-red.doodad + + # Tag the category for these doodads + for i in *.doodad; do\ + doodad edit-doodad --tag "category=creatures" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/bird/bird.js b/doodads/bird/bird.js new file mode 100644 index 0000000..5d94ebe --- /dev/null +++ b/doodads/bird/bird.js @@ -0,0 +1,99 @@ +// Bird + +function main() { + var speed = 4; + var Vx = Vy = 0; + var altitude = Self.Position().Y; // original height in the level + + var direction = "left", + lastDirection = "left"; + var states = { + flying: 0, + diving: 1, + }; + var state = states.flying; + + Self.SetMobile(true); + Self.SetGravity(false); + Self.SetHitbox(0, 0, 46, 32); + Self.AddAnimation("fly-left", 100, ["left-1", "left-2"]); + Self.AddAnimation("fly-right", 100, ["right-1", "right-2"]); + + // Player Character controls? + if (Self.IsPlayer()) { + return player(); + } + + Events.OnCollide(function (e) { + if (e.Actor.IsMobile() && e.InHitbox) { + return false; + } + }); + + // Sample our X position every few frames and detect if we've hit a solid wall. + var sampleTick = 0; + var sampleRate = 2; + var lastSampledX = 0; + var lastSampledY = 0; + + setInterval(function () { + if (sampleTick % sampleRate === 0) { + var curX = Self.Position().X; + var delta = Math.abs(curX - lastSampledX); + if (delta < 5) { + direction = direction === "right" ? "left" : "right"; + } + lastSampledX = curX; + } + sampleTick++; + + // 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)); + + // If we changed directions, stop animating now so we can + // turn around quickly without moonwalking. + if (direction !== lastDirection) { + Self.StopAnimation(); + } + + if (!Self.IsAnimating()) { + Self.PlayAnimation("fly-" + direction, null); + } + + lastDirection = direction; + }, 100); +} + +// If under control of the player character. +function player() { + Self.SetInventory(true); + Events.OnKeypress(function (ev) { + Vx = 0; + Vy = 0; + + if (ev.Up) { + Vy = -playerSpeed; + } else if (ev.Down) { + Vy = playerSpeed; + } + + if (ev.Right) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("fly-right", null); + } + Vx = playerSpeed; + } else if (ev.Left) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("fly-left", null); + } + Vx = -playerSpeed; + } else { + Self.StopAnimation(); + animating = false; + } + + Self.SetVelocity(Vector(Vx, Vy)); + }) +} \ No newline at end of file diff --git a/doodads/bird/dive-left.png b/doodads/bird/dive-left.png new file mode 100644 index 0000000..4ec5794 Binary files /dev/null and b/doodads/bird/dive-left.png differ diff --git a/doodads/bird/dive-right.png b/doodads/bird/dive-right.png new file mode 100644 index 0000000..8516ae3 Binary files /dev/null and b/doodads/bird/dive-right.png differ diff --git a/doodads/bird/left-1.png b/doodads/bird/left-1.png new file mode 100644 index 0000000..e3c6e50 Binary files /dev/null and b/doodads/bird/left-1.png differ diff --git a/doodads/bird/left-2.png b/doodads/bird/left-2.png new file mode 100644 index 0000000..e093f1f Binary files /dev/null and b/doodads/bird/left-2.png differ diff --git a/doodads/bird/right-1.png b/doodads/bird/right-1.png new file mode 100644 index 0000000..91930e2 Binary files /dev/null and b/doodads/bird/right-1.png differ diff --git a/doodads/bird/right-2.png b/doodads/bird/right-2.png new file mode 100644 index 0000000..380b3b3 Binary files /dev/null and b/doodads/bird/right-2.png differ diff --git a/doodads/box/Makefile b/doodads/box/Makefile new file mode 100644 index 0000000..ddbb2a1 --- /dev/null +++ b/doodads/box/Makefile @@ -0,0 +1,13 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Box" box-1.png box-2.png \ + box-3.png box-4.png box.doodad + doodad install-script box.js box.doodad + + for i in *.doodad; do \ + doodad edit-doodad --tag "category=objects" $${i}; \ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/box/box-1.png b/doodads/box/box-1.png new file mode 100644 index 0000000..29b33bd Binary files /dev/null and b/doodads/box/box-1.png differ diff --git a/doodads/box/box-2.png b/doodads/box/box-2.png new file mode 100644 index 0000000..d6028af Binary files /dev/null and b/doodads/box/box-2.png differ diff --git a/doodads/box/box-3.png b/doodads/box/box-3.png new file mode 100644 index 0000000..f94618f Binary files /dev/null and b/doodads/box/box-3.png differ diff --git a/doodads/box/box-4.png b/doodads/box/box-4.png new file mode 100644 index 0000000..204421e Binary files /dev/null and b/doodads/box/box-4.png differ diff --git a/doodads/box/box.js b/doodads/box/box.js new file mode 100644 index 0000000..30d3d6a --- /dev/null +++ b/doodads/box/box.js @@ -0,0 +1,64 @@ +// Pushable Box. +var speed = 4; +var size = 75; + +function main() { + Self.SetMobile(true); + Self.SetGravity(true); + Self.SetHitbox(0, 0, size, size); + + Events.OnCollide(function (e) { + // Ignore events from neighboring Boxes. + if (e.Actor.Actor.Filename === "box.doodad") { + return false; + } + + if (e.Actor.IsMobile() && e.InHitbox) { + var overlap = e.Overlap; + + if (overlap.Y === 0 && !(overlap.X === 0 && overlap.W < 5) && !(overlap.X === size)) { + // Standing on top, ignore. + return false; + } else if (overlap.Y === size) { + // From the bottom, boop it up. + Self.SetVelocity(Vector(0, -speed * 2)) + } + + // If touching from the sides, slide away. + if (overlap.X === 0) { + Self.SetVelocity(Vector(speed, 0)) + } else if (overlap.X === size) { + Self.SetVelocity(Vector(-speed, 0)) + } + + return false; + } + }); + Events.OnLeave(function (e) { + Self.SetVelocity(Vector(0, 0)); + }); + + // When we receive power, we reset to our original position. + var origPoint = Self.Position(); + Message.Subscribe("power", function (powered) { + Self.MoveTo(origPoint); + Self.SetVelocity(Vector(0, 0)); + }); + + // Start animation on a loop. + animate(); +} + +function animate() { + Self.AddAnimation("animate", 100, [0, 1, 2, 3, 2, 1]); + + var running = false; + setInterval(function () { + if (!running) { + running = true; + Self.PlayAnimation("animate", function () { + running = false; + }) + } + }, 100); +} \ No newline at end of file diff --git a/doodads/boy/Makefile b/doodads/boy/Makefile new file mode 100644 index 0000000..39d98a8 --- /dev/null +++ b/doodads/boy/Makefile @@ -0,0 +1,13 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Boy" stand-right.png stand-left.png \ + walk-right-1.png walk-right-2.png walk-right-3.png \ + walk-left-1.png walk-left-2.png walk-left-3.png \ + boy.doodad + doodad install-script boy.js boy.doodad + + doodad edit-doodad --tag "category=creatures" boy.doodad + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/boy/boy.js b/doodads/boy/boy.js new file mode 100644 index 0000000..02f877b --- /dev/null +++ b/doodads/boy/boy.js @@ -0,0 +1,38 @@ +function main() { + var playerSpeed = 12; + var gravity = 4; + var Vx = Vy = 0; + + var animating = false; + var animStart = animEnd = 0; + var animFrame = animStart; + + Self.SetMobile(true); + Self.SetInventory(true); + Self.SetGravity(true); + Self.SetHitbox(0, 0, 32, 52); + Self.AddAnimation("walk-left", 200, ["stand-left", "walk-left-1", "walk-left-2", "walk-left-3", "walk-left-2", "walk-left-1"]); + Self.AddAnimation("walk-right", 200, ["stand-right", "walk-right-1", "walk-right-2", "walk-right-3", "walk-right-2", "walk-right-1"]); + + Events.OnKeypress(function (ev) { + Vx = 0; + Vy = 0; + + if (ev.Right) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-right", null); + } + Vx = playerSpeed; + } else if (ev.Left) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-left", null); + } + Vx = -playerSpeed; + } else { + Self.StopAnimation(); + animating = false; + } + + // Self.SetVelocity(Point(Vx, Vy)); + }) +} diff --git a/doodads/boy/stand-left.png b/doodads/boy/stand-left.png new file mode 100644 index 0000000..3ce4be7 Binary files /dev/null and b/doodads/boy/stand-left.png differ diff --git a/doodads/boy/stand-right.png b/doodads/boy/stand-right.png new file mode 100644 index 0000000..66a85d1 Binary files /dev/null and b/doodads/boy/stand-right.png differ diff --git a/doodads/boy/walk-left-1.png b/doodads/boy/walk-left-1.png new file mode 100644 index 0000000..733624d Binary files /dev/null and b/doodads/boy/walk-left-1.png differ diff --git a/doodads/boy/walk-left-2.png b/doodads/boy/walk-left-2.png new file mode 100644 index 0000000..1256cc6 Binary files /dev/null and b/doodads/boy/walk-left-2.png differ diff --git a/doodads/boy/walk-left-3.png b/doodads/boy/walk-left-3.png new file mode 100644 index 0000000..39128c4 Binary files /dev/null and b/doodads/boy/walk-left-3.png differ diff --git a/doodads/boy/walk-right-1.png b/doodads/boy/walk-right-1.png new file mode 100644 index 0000000..c422cfa Binary files /dev/null and b/doodads/boy/walk-right-1.png differ diff --git a/doodads/boy/walk-right-2.png b/doodads/boy/walk-right-2.png new file mode 100644 index 0000000..2aac09e Binary files /dev/null and b/doodads/boy/walk-right-2.png differ diff --git a/doodads/boy/walk-right-3.png b/doodads/boy/walk-right-3.png new file mode 100644 index 0000000..0bd2b72 Binary files /dev/null and b/doodads/boy/walk-right-3.png differ diff --git a/doodads/boy/walk-right.gif b/doodads/boy/walk-right.gif new file mode 100644 index 0000000..e6e2d30 Binary files /dev/null and b/doodads/boy/walk-right.gif differ diff --git a/doodads/build.sh b/doodads/build.sh new file mode 100755 index 0000000..6bc41eb --- /dev/null +++ b/doodads/build.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# Build all the doodads from their source files. +if [[ ! -d "./azulian" ]]; then + echo Run this script from the dev-assets/doodads/ working directory. + exit 1 +fi + +mkdir -p ../../assets/doodads + +boy() { + cd boy/ + make + cd .. + + cd thief/ + make + cd .. +} + +buttons() { + cd buttons/ + make + cd .. +} + +switches() { + cd switches/ + make + cd .. +} + +doors() { + cd doors/ + make + cd .. +} + +trapdoors() { + cd trapdoors/ + make + cd .. +} + +azulians() { + cd azulian/ + make + cd .. +} + +mobs() { + cd bird/ + make + cd .. +} + +objects() { + cd objects/ + make + cd .. + + cd box/ + make + cd .. + + cd crumbly-floor/ + make + cd .. + + cd regions/ + make + cd .. +} + +onoff() { + cd on-off/ + make + cd .. +} + +warpdoor() { + cd warp-door/ + make + cd .. +} + +boy +buttons +switches +doors +trapdoors +azulians +mobs +objects +onoff +warpdoor +doodad edit-doodad -quiet -lock -author "Noah" ../../assets/doodads/*.doodad +doodad edit-doodad ../../assets/doodads/azu-blu.doodad +doodad edit-doodad -hide ../../assets/doodads/boy.doodad diff --git a/doodads/buttons/Makefile b/doodads/buttons/Makefile new file mode 100644 index 0000000..bd82563 --- /dev/null +++ b/doodads/buttons/Makefile @@ -0,0 +1,19 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Sticky Button" sticky1.png sticky2.png button-sticky.doodad + doodad install-script sticky.js button-sticky.doodad + + doodad convert -t "Button" button1.png button2.png button.doodad + doodad install-script button.js button.doodad + + doodad convert -t "Button Type B" typeB1.png typeB2.png button-typeB.doodad + doodad install-script button.js button-typeB.doodad + + # Tag the category for these doodads + for i in *.doodad; do\ + doodad edit-doodad --tag "category=gizmos" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/buttons/README.md b/doodads/buttons/README.md new file mode 100644 index 0000000..001f1bb --- /dev/null +++ b/doodads/buttons/README.md @@ -0,0 +1,12 @@ +# Button Doodads + +```bash +doodad convert -t "Sticky Button" sticky1.png sticky2.png sticky-button.doodad +doodad install-script sticky.js sticky-button.doodad + +doodad convert -t "Button" button1.png button2.png button.doodad +doodad install-script button.js button.doodad + +doodad convert -t "Button Type B" typeB1.png typeB2.png button-typeB.doodad +doodad install-script button.js button-typeB.doodad +``` diff --git a/doodads/buttons/button.js b/doodads/buttons/button.js new file mode 100644 index 0000000..c31e342 --- /dev/null +++ b/doodads/buttons/button.js @@ -0,0 +1,48 @@ +function main() { + var timer = 0; + var pressed = false; + + // Has a linked Sticky Button been pressed permanently down? + var stickyDown = false; + Message.Subscribe("sticky:down", function(down) { + stickyDown = down; + Self.ShowLayer(stickyDown ? 1 : 0); + }); + + Events.OnCollide(function(e) { + if (!e.Settled) { + return; + } + + // If a linked Sticky Button is pressed, button stays down too and + // doesn't interact. + if (stickyDown) { + return; + } + + // Verify they've touched the button. + if (e.Overlap.Y + e.Overlap.H < 24) { + return; + } + + if (!pressed && !stickyDown) { + Sound.Play("button-down.wav") + Message.Publish("power", true); + pressed = true; + } + + + if (timer > 0) { + clearTimeout(timer); + } + + Self.ShowLayer(1); + timer = setTimeout(function() { + Sound.Play("button-up.wav") + Self.ShowLayer(0); + Message.Publish("power", false); + timer = 0; + pressed = false; + }, 200); + }); +} diff --git a/doodads/buttons/button1.png b/doodads/buttons/button1.png new file mode 100644 index 0000000..6736af8 Binary files /dev/null and b/doodads/buttons/button1.png differ diff --git a/doodads/buttons/button2.png b/doodads/buttons/button2.png new file mode 100644 index 0000000..67c3559 Binary files /dev/null and b/doodads/buttons/button2.png differ diff --git a/doodads/buttons/sticky.js b/doodads/buttons/sticky.js new file mode 100644 index 0000000..1702f8c --- /dev/null +++ b/doodads/buttons/sticky.js @@ -0,0 +1,35 @@ +function main() { + var pressed = false; + + // When a sticky button receives power, it pops back up. + Message.Subscribe("power", function (powered) { + if (powered && pressed) { + Self.ShowLayer(0); + pressed = false; + Sound.Play("button-up.wav") + Message.Publish("power", false); + Message.Publish("sticky:down", false); + } + }) + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + if (pressed) { + return; + } + + // Verify they've touched the button. + if (e.Overlap.Y + e.Overlap.H < 24) { + return; + } + + Sound.Play("button-down.wav") + Self.ShowLayer(1); + pressed = true; + Message.Publish("power", true); + Message.Publish("sticky:down", true); + }); +} diff --git a/doodads/buttons/sticky1.png b/doodads/buttons/sticky1.png new file mode 100644 index 0000000..dbd955b Binary files /dev/null and b/doodads/buttons/sticky1.png differ diff --git a/doodads/buttons/sticky2.png b/doodads/buttons/sticky2.png new file mode 100644 index 0000000..c9e556b Binary files /dev/null and b/doodads/buttons/sticky2.png differ diff --git a/doodads/buttons/typeB1.png b/doodads/buttons/typeB1.png new file mode 100644 index 0000000..ff2d2b4 Binary files /dev/null and b/doodads/buttons/typeB1.png differ diff --git a/doodads/buttons/typeB2.png b/doodads/buttons/typeB2.png new file mode 100644 index 0000000..5cfe20c Binary files /dev/null and b/doodads/buttons/typeB2.png differ diff --git a/doodads/crumbly-floor/Makefile b/doodads/crumbly-floor/Makefile new file mode 100644 index 0000000..7fe4048 --- /dev/null +++ b/doodads/crumbly-floor/Makefile @@ -0,0 +1,12 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Crumbly Floor" floor.png shake1.png shake2.png \ + fall1.png fall2.png fall3.png fall4.png fallen.png \ + crumbly-floor.doodad + doodad install-script crumbly-floor.js crumbly-floor.doodad + for i in *.doodad; do\ + doodad edit-doodad --tag "category=objects" $${i};\ + done + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/crumbly-floor/crumbly-floor.js b/doodads/crumbly-floor/crumbly-floor.js new file mode 100644 index 0000000..c7bdf08 --- /dev/null +++ b/doodads/crumbly-floor/crumbly-floor.js @@ -0,0 +1,62 @@ +// Crumbly Floor. +function main() { + Self.SetHitbox(0, 0, 98, 11); + + Self.AddAnimation("shake", 100, ["shake1", "shake2", "floor", "shake1", "shake2", "floor"]); + Self.AddAnimation("fall", 100, ["fall1", "fall2", "fall3", "fall4"]); + + // Recover time for the floor to respawn. + var recover = 5000; + + // States of the floor. + var stateSolid = 0; + var stateShaking = 1; + var stateFalling = 2; + var stateFallen = 3; + var state = stateSolid; + + // Started the animation? + var startedAnimation = false; + + Events.OnCollide(function(e) { + + // If the floor is falling, the player passes right thru. + if (state === stateFalling || state === stateFallen) { + return; + } + + // Floor is solid until it begins to fall. + if (e.InHitbox && (state === stateSolid || state === stateShaking)) { + // Only activate when touched from the top. + if (e.Overlap.Y > 0) { + return false; + } + + // If movement is not settled, be solid. + if (!e.Settled) { + return false; + } + + // Begin the animation sequence if we're in the solid state. + if (state === stateSolid) { + state = stateShaking; + Self.PlayAnimation("shake", function() { + state = stateFalling; + Self.PlayAnimation("fall", function() { + Sound.Play("crumbly-break.wav") + state = stateFallen; + Self.ShowLayerNamed("fallen"); + + // Recover after a while. + setTimeout(function() { + Self.ShowLayer(0); + state = stateSolid; + }, recover); + }); + }) + } + + return false; + } + }); +} diff --git a/doodads/crumbly-floor/fall1.png b/doodads/crumbly-floor/fall1.png new file mode 100644 index 0000000..fdc1616 Binary files /dev/null and b/doodads/crumbly-floor/fall1.png differ diff --git a/doodads/crumbly-floor/fall2.png b/doodads/crumbly-floor/fall2.png new file mode 100644 index 0000000..ac135c2 Binary files /dev/null and b/doodads/crumbly-floor/fall2.png differ diff --git a/doodads/crumbly-floor/fall3.png b/doodads/crumbly-floor/fall3.png new file mode 100644 index 0000000..cad059d Binary files /dev/null and b/doodads/crumbly-floor/fall3.png differ diff --git a/doodads/crumbly-floor/fall4.png b/doodads/crumbly-floor/fall4.png new file mode 100644 index 0000000..11f6c98 Binary files /dev/null and b/doodads/crumbly-floor/fall4.png differ diff --git a/doodads/crumbly-floor/fallen.png b/doodads/crumbly-floor/fallen.png new file mode 100644 index 0000000..ffd3423 Binary files /dev/null and b/doodads/crumbly-floor/fallen.png differ diff --git a/doodads/crumbly-floor/floor.png b/doodads/crumbly-floor/floor.png new file mode 100644 index 0000000..c592c09 Binary files /dev/null and b/doodads/crumbly-floor/floor.png differ diff --git a/doodads/crumbly-floor/shake1.png b/doodads/crumbly-floor/shake1.png new file mode 100644 index 0000000..b59c251 Binary files /dev/null and b/doodads/crumbly-floor/shake1.png differ diff --git a/doodads/crumbly-floor/shake2.png b/doodads/crumbly-floor/shake2.png new file mode 100644 index 0000000..83723ef Binary files /dev/null and b/doodads/crumbly-floor/shake2.png differ diff --git a/doodads/doors/Makefile b/doodads/doors/Makefile new file mode 100644 index 0000000..4f3c106 --- /dev/null +++ b/doodads/doors/Makefile @@ -0,0 +1,7 @@ +SHELL = /bin/bash + +ALL: build + +.PHONY: build +build: + ./build.sh diff --git a/doodads/doors/README.md b/doodads/doors/README.md new file mode 100644 index 0000000..8fc5bf2 --- /dev/null +++ b/doodads/doors/README.md @@ -0,0 +1,15 @@ +# Button Doodads + +```bash +doodad convert -t "Red Door" red1.png red2.png red-door.doodad +doodad convert -t "Blue Door" blue1.png blue2.png blue-door.doodad +doodad convert -t "Green Door" green1.png green2.png green-door.doodad +doodad convert -t "Yellow Door" yellow1.png yellow2.png yellow-door.doodad + +doodad convert -t "Red Key" red-key.png red-key.doodad +doodad convert -t "Blue Key" blue-key.png blue-key.doodad +doodad convert -t "Green Key" green-key.png green-key.doodad +doodad convert -t "Yellow Key" yellow-key.png yellow-key.doodad + +doodad convert -t "Electric Door" electric{1,2,3,4}.png electric-door.doodad +``` diff --git a/doodads/doors/blue-closed.png b/doodads/doors/blue-closed.png new file mode 100644 index 0000000..c8e2c8b Binary files /dev/null and b/doodads/doors/blue-closed.png differ diff --git a/doodads/doors/blue-key.png b/doodads/doors/blue-key.png new file mode 100644 index 0000000..11e4355 Binary files /dev/null and b/doodads/doors/blue-key.png differ diff --git a/doodads/doors/blue-left.png b/doodads/doors/blue-left.png new file mode 100644 index 0000000..98a5bfb Binary files /dev/null and b/doodads/doors/blue-left.png differ diff --git a/doodads/doors/blue-right.png b/doodads/doors/blue-right.png new file mode 100644 index 0000000..472c545 Binary files /dev/null and b/doodads/doors/blue-right.png differ diff --git a/doodads/doors/blue-unlocked.png b/doodads/doors/blue-unlocked.png new file mode 100644 index 0000000..660ce7b Binary files /dev/null and b/doodads/doors/blue-unlocked.png differ diff --git a/doodads/doors/blue1.png b/doodads/doors/blue1.png new file mode 100644 index 0000000..13ad51b Binary files /dev/null and b/doodads/doors/blue1.png differ diff --git a/doodads/doors/blue2.png b/doodads/doors/blue2.png new file mode 100644 index 0000000..1e5bcdb Binary files /dev/null and b/doodads/doors/blue2.png differ diff --git a/doodads/doors/build.sh b/doodads/doors/build.sh new file mode 100755 index 0000000..7615a8d --- /dev/null +++ b/doodads/doors/build.sh @@ -0,0 +1,52 @@ +# 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-unlocked.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-unlocked.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-unlocked.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-unlocked.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 "Small Key Door" small-closed.png small-unlocked.png small-right.png small-left.png small-key-door.doodad +doodad edit-doodad -q --tag color=small small-key-door.doodad +doodad install-script colored-door.js small-key-door.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 "Small Key" small-key.png small-key.doodad +doodad edit-doodad -q --tag color=small small-key.doodad +doodad install-script keys.js small-key.doodad + +doodad convert -t "Electric Door" electric{1,2,3,4}.png door-electric.doodad +doodad install-script electric-door.js door-electric.doodad + +# Tag the category for these doodads +for i in *.doodad; do doodad edit-doodad --tag "category=doors" $i; done +doodad edit-doodad --tag "category=doors,gizmos" door-electric.doodad + +cp *.doodad ../../../assets/doodads/ diff --git a/doodads/doors/colored-door.js b/doodads/doors/colored-door.js new file mode 100644 index 0000000..0bfba60 --- /dev/null +++ b/doodads/doors/colored-door.js @@ -0,0 +1,66 @@ +function main() { + var color = Self.GetTag("color"); + var keyname = color === "small" ? "small-key.doodad" : "key-" + color + ".doodad"; + + // Layers in the doodad image. + var layer = { + closed: 0, + unlocked: 1, + right: 2, + left: 3, + }; + + // 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(34, 0, 13, 76); + + 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; + Sound.Play("door-open.wav") + return; + } + + // Do they have our key? + var hasKey = e.Actor.HasItem(keyname) >= 0; + if (!hasKey) { + // Door is locked. + return false; + } + + if (e.Settled) { + unlocked = true; + Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); + Sound.Play("unlock.wav"); + + // If a Small Key door, consume a small key. + if (color === "small") { + e.Actor.RemoveItem(keyname, 1) + } + } + } + }); + Events.OnLeave(function(e) { + Self.ShowLayer(unlocked ? layer.unlocked : layer.closed); + // Sound.Play("door-close.wav") + + // Reset collision state. + opened = false; + enterSide = 0; + }); +} diff --git a/doodads/doors/electric-door.js b/doodads/doors/electric-door.js new file mode 100644 index 0000000..1f4be7c --- /dev/null +++ b/doodads/doors/electric-door.js @@ -0,0 +1,66 @@ +var animating = false; +var opened = false; +var powerState = false; + +// Function to handle the door opening or closing. +function setPoweredState(powered) { + powerState = powered; + + console.log("setPoweredState: %+v", powered) + if (powered) { + if (animating || opened) { + return; + } + + animating = true; + Sound.Play("electric-door.wav") + Self.PlayAnimation("open", function() { + opened = true; + animating = false; + }); + } else { + animating = true; + Sound.Play("electric-door.wav") + Self.PlayAnimation("close", function() { + opened = false; + animating = false; + }) + } +} + +function main() { + Self.AddAnimation("open", 100, [0, 1, 2, 3]); + Self.AddAnimation("close", 100, [3, 2, 1, 0]); + + + Self.SetHitbox(0, 0, 34, 76); + + // A linked Switch that activates the door will send the Toggle signal + // immediately before the Power signal. The door can just invert its + // state on this signal, and ignore the very next Power signal. Ordinary + // power sources like Buttons will work as normal, as they emit only a power + // signal. + var ignoreNextPower = false; + Message.Subscribe("switch:toggle", function(powered) { + console.log("A switch powered %+v, setPoweredState(%+v) to opposite", powered, powerState); + ignoreNextPower = true; + setPoweredState(!powerState); + }) + + Message.Subscribe("power", function(powered) { + if (ignoreNextPower) { + ignoreNextPower = false; + return; + } + + setPoweredState(powered); + }); + + Events.OnCollide(function(e) { + if (e.InHitbox) { + if (!opened) { + return false; + } + } + }); +} diff --git a/doodads/doors/electric.gif b/doodads/doors/electric.gif new file mode 100644 index 0000000..c280b2d Binary files /dev/null and b/doodads/doors/electric.gif differ diff --git a/doodads/doors/electric1.png b/doodads/doors/electric1.png new file mode 100644 index 0000000..26a378b Binary files /dev/null and b/doodads/doors/electric1.png differ diff --git a/doodads/doors/electric2.png b/doodads/doors/electric2.png new file mode 100644 index 0000000..95aad3e Binary files /dev/null and b/doodads/doors/electric2.png differ diff --git a/doodads/doors/electric3.png b/doodads/doors/electric3.png new file mode 100644 index 0000000..ffaf07a Binary files /dev/null and b/doodads/doors/electric3.png differ diff --git a/doodads/doors/electric4.png b/doodads/doors/electric4.png new file mode 100644 index 0000000..e54c18f Binary files /dev/null and b/doodads/doors/electric4.png differ diff --git a/doodads/doors/green-closed.png b/doodads/doors/green-closed.png new file mode 100644 index 0000000..e178cda Binary files /dev/null and b/doodads/doors/green-closed.png differ diff --git a/doodads/doors/green-key.png b/doodads/doors/green-key.png new file mode 100644 index 0000000..fe876aa Binary files /dev/null and b/doodads/doors/green-key.png differ diff --git a/doodads/doors/green-left.png b/doodads/doors/green-left.png new file mode 100644 index 0000000..37728e5 Binary files /dev/null and b/doodads/doors/green-left.png differ diff --git a/doodads/doors/green-right.png b/doodads/doors/green-right.png new file mode 100644 index 0000000..137716b Binary files /dev/null and b/doodads/doors/green-right.png differ diff --git a/doodads/doors/green-unlocked.png b/doodads/doors/green-unlocked.png new file mode 100644 index 0000000..254fadb Binary files /dev/null and b/doodads/doors/green-unlocked.png differ diff --git a/doodads/doors/green1.png b/doodads/doors/green1.png new file mode 100644 index 0000000..e49c653 Binary files /dev/null and b/doodads/doors/green1.png differ diff --git a/doodads/doors/green2.png b/doodads/doors/green2.png new file mode 100644 index 0000000..9e229d0 Binary files /dev/null and b/doodads/doors/green2.png differ diff --git a/doodads/doors/keys.js b/doodads/doors/keys.js new file mode 100644 index 0000000..469a158 --- /dev/null +++ b/doodads/doors/keys.js @@ -0,0 +1,14 @@ +function main() { + var color = Self.GetTag("color"); + var quantity = color === "small" ? 1 : 0; + + Events.OnCollide(function (e) { + if (e.Settled) { + if (e.Actor.HasInventory()) { + Sound.Play("item-get.wav") + e.Actor.AddItem(Self.Filename, quantity); + Self.Destroy(); + } + } + }) +} diff --git a/doodads/doors/locked-door.js b/doodads/doors/locked-door.js new file mode 100644 index 0000000..820ae1a --- /dev/null +++ b/doodads/doors/locked-door.js @@ -0,0 +1,27 @@ +// DEPRECATED: old locked door script. Superceded by colored-door.js. +function main() { + Self.AddAnimation("open", 0, [1]); + var unlocked = false; + var color = Self.GetTag("color"); + + Self.SetHitbox(16, 0, 32, 64); + + Events.OnCollide(function(e) { + if (unlocked) { + return; + } + + if (e.InHitbox) { + var data = e.Actor.GetData("key:" + color); + if (data === "") { + // Door is locked. + return false; + } + + if (e.Settled) { + unlocked = true; + Self.PlayAnimation("open", null); + } + } + }); +} diff --git a/doodads/doors/red-closed.png b/doodads/doors/red-closed.png new file mode 100644 index 0000000..57fa66a Binary files /dev/null and b/doodads/doors/red-closed.png differ diff --git a/doodads/doors/red-key.png b/doodads/doors/red-key.png new file mode 100644 index 0000000..38db173 Binary files /dev/null and b/doodads/doors/red-key.png differ diff --git a/doodads/doors/red-left.png b/doodads/doors/red-left.png new file mode 100644 index 0000000..a345af8 Binary files /dev/null and b/doodads/doors/red-left.png differ diff --git a/doodads/doors/red-right.png b/doodads/doors/red-right.png new file mode 100644 index 0000000..de5da7c Binary files /dev/null and b/doodads/doors/red-right.png differ diff --git a/doodads/doors/red-unlocked.png b/doodads/doors/red-unlocked.png new file mode 100644 index 0000000..8124fb5 Binary files /dev/null and b/doodads/doors/red-unlocked.png differ diff --git a/doodads/doors/red1.png b/doodads/doors/red1.png new file mode 100644 index 0000000..c963c2d Binary files /dev/null and b/doodads/doors/red1.png differ diff --git a/doodads/doors/red2.png b/doodads/doors/red2.png new file mode 100644 index 0000000..07dc65f Binary files /dev/null and b/doodads/doors/red2.png differ diff --git a/doodads/doors/small-closed.png b/doodads/doors/small-closed.png new file mode 100644 index 0000000..b97ae46 Binary files /dev/null and b/doodads/doors/small-closed.png differ diff --git a/doodads/doors/small-key.png b/doodads/doors/small-key.png new file mode 100644 index 0000000..11e4eca Binary files /dev/null and b/doodads/doors/small-key.png differ diff --git a/doodads/doors/small-left.png b/doodads/doors/small-left.png new file mode 100644 index 0000000..273786f Binary files /dev/null and b/doodads/doors/small-left.png differ diff --git a/doodads/doors/small-right.png b/doodads/doors/small-right.png new file mode 100644 index 0000000..4f55056 Binary files /dev/null and b/doodads/doors/small-right.png differ diff --git a/doodads/doors/small-unlocked.png b/doodads/doors/small-unlocked.png new file mode 100644 index 0000000..5596796 Binary files /dev/null and b/doodads/doors/small-unlocked.png differ diff --git a/doodads/doors/yellow-closed.png b/doodads/doors/yellow-closed.png new file mode 100644 index 0000000..867e05c Binary files /dev/null and b/doodads/doors/yellow-closed.png differ diff --git a/doodads/doors/yellow-key.png b/doodads/doors/yellow-key.png new file mode 100644 index 0000000..c83c738 Binary files /dev/null and b/doodads/doors/yellow-key.png differ diff --git a/doodads/doors/yellow-left.png b/doodads/doors/yellow-left.png new file mode 100644 index 0000000..944a420 Binary files /dev/null and b/doodads/doors/yellow-left.png differ diff --git a/doodads/doors/yellow-right.png b/doodads/doors/yellow-right.png new file mode 100644 index 0000000..4b89710 Binary files /dev/null and b/doodads/doors/yellow-right.png differ diff --git a/doodads/doors/yellow-unlocked.png b/doodads/doors/yellow-unlocked.png new file mode 100644 index 0000000..da2d0e7 Binary files /dev/null and b/doodads/doors/yellow-unlocked.png differ diff --git a/doodads/doors/yellow1.png b/doodads/doors/yellow1.png new file mode 100644 index 0000000..b6a6e72 Binary files /dev/null and b/doodads/doors/yellow1.png differ diff --git a/doodads/doors/yellow2.png b/doodads/doors/yellow2.png new file mode 100644 index 0000000..a985563 Binary files /dev/null and b/doodads/doors/yellow2.png differ diff --git a/doodads/mischievous.js b/doodads/mischievous.js new file mode 100644 index 0000000..c7b4e0b --- /dev/null +++ b/doodads/mischievous.js @@ -0,0 +1,43 @@ +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); + }) +} diff --git a/doodads/objects/Makefile b/doodads/objects/Makefile new file mode 100644 index 0000000..e79ee47 --- /dev/null +++ b/doodads/objects/Makefile @@ -0,0 +1,25 @@ +ALL: build + +.PHONY: build +build: + # Start Flag + doodad convert -t "Start Flag" start-flag.png start-flag.doodad + doodad install-script start-flag.js start-flag.doodad + + # Exit Flag + doodad convert -t "Exit Flag" exit-flag.png exit-flag.doodad + doodad install-script exit-flag.js exit-flag.doodad + + # Checkpoint Flag + doodad convert -t "Checkpoint Flag" checkpoint-active.png \ + checkpoint-inactive.png checkpoint-flag.doodad + doodad install-script checkpoint-flag.js checkpoint-flag.doodad + + # Anvil + doodad convert -t "Anvil" anvil.png anvil.doodad + doodad install-script anvil.js anvil.doodad + + for i in *.doodad; do\ + doodad edit-doodad --tag "category=objects" $${i};\ + done + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/objects/anvil.js b/doodads/objects/anvil.js new file mode 100644 index 0000000..2359bca --- /dev/null +++ b/doodads/objects/anvil.js @@ -0,0 +1,51 @@ +// Anvil +var falling = false; + +function main() { + // Note: doodad is not "solid" but hurts if it falls on you. + Self.SetHitbox(0, 0, 48, 25); + Self.SetMobile(true); + Self.SetGravity(true); + + // Monitor our Y position to tell if we've been falling. + var lastPoint = Self.Position(); + setInterval(function () { + var nowAt = Self.Position(); + if (nowAt.Y > lastPoint.Y) { + falling = true; + } else { + falling = false; + } + lastPoint = nowAt; + }, 100); + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + // Were we falling? + if (falling) { + if (e.InHitbox) { + if (e.Actor.IsPlayer()) { + // Fatal to the player. + Sound.Play("crumbly-break.wav"); + FailLevel("Watch out for anvils!"); + return; + } + else if (e.Actor.IsMobile()) { + // Destroy mobile doodads. + Sound.Play("crumbly-break.wav"); + e.Actor.Destroy(); + } + } + } + }); + + // When we receive power, we reset to our original position. + var origPoint = Self.Position(); + Message.Subscribe("power", function (powered) { + Self.MoveTo(origPoint); + Self.SetVelocity(Vector(0, 0)); + }); +} diff --git a/doodads/objects/anvil.png b/doodads/objects/anvil.png new file mode 100644 index 0000000..205becc Binary files /dev/null and b/doodads/objects/anvil.png differ diff --git a/doodads/objects/checkpoint-active.png b/doodads/objects/checkpoint-active.png new file mode 100644 index 0000000..d8d9503 Binary files /dev/null and b/doodads/objects/checkpoint-active.png differ diff --git a/doodads/objects/checkpoint-flag.js b/doodads/objects/checkpoint-flag.js new file mode 100644 index 0000000..a50608a --- /dev/null +++ b/doodads/objects/checkpoint-flag.js @@ -0,0 +1,38 @@ +// Checkpoint Flag. +var isCurrentCheckpoint = false; + +function main() { + Self.SetHitbox(22 + 16, 16, 75 - 16, 86); + setActive(false); + + // Checkpoints broadcast to all of their peers so they all + // know which one is the most recently activated. + Message.Subscribe("broadcast:checkpoint", function (currentID) { + setActive(false); + }); + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + // Only care about the player character. + if (!e.Actor.IsPlayer()) { + return; + } + + // Set the player checkpoint. + SetCheckpoint(Self.Position()); + setActive(true); + Message.Broadcast("broadcast:checkpoint", Self.ID()) + }); +} + +function setActive(v) { + if (v && !isCurrentCheckpoint) { + Flash("Checkpoint!"); + } + + isCurrentCheckpoint = v; + Self.ShowLayerNamed(v ? "checkpoint-active" : "checkpoint-inactive"); +} \ No newline at end of file diff --git a/doodads/objects/checkpoint-inactive.png b/doodads/objects/checkpoint-inactive.png new file mode 100644 index 0000000..6781ff9 Binary files /dev/null and b/doodads/objects/checkpoint-inactive.png differ diff --git a/doodads/objects/exit-flag.js b/doodads/objects/exit-flag.js new file mode 100644 index 0000000..9e65bf1 --- /dev/null +++ b/doodads/objects/exit-flag.js @@ -0,0 +1,19 @@ +// Exit Flag. +function main() { + Self.SetHitbox(22 + 16, 16, 75 - 16, 86); + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + // Only care if it's the player. + if (!e.Actor.IsPlayer()) { + return; + } + + if (e.InHitbox) { + EndLevel(); + } + }); +} diff --git a/doodads/objects/exit-flag.png b/doodads/objects/exit-flag.png new file mode 100644 index 0000000..585152d Binary files /dev/null and b/doodads/objects/exit-flag.png differ diff --git a/doodads/objects/start-flag.js b/doodads/objects/start-flag.js new file mode 100644 index 0000000..dc84a77 --- /dev/null +++ b/doodads/objects/start-flag.js @@ -0,0 +1,11 @@ +// Start Flag. +function main() { + Self.SetHitbox(22 + 16, 16, 75 - 16, 86); + + // Linking a doodad to the Start Flag sets the + // player character. Destroy the original doodads. + var links = Self.GetLinks(); + for (var i = 0; i < links.length; i++) { + links[i].Destroy(); + } +} diff --git a/doodads/objects/start-flag.png b/doodads/objects/start-flag.png new file mode 100644 index 0000000..125550e Binary files /dev/null and b/doodads/objects/start-flag.png differ diff --git a/doodads/on-off/Makefile b/doodads/on-off/Makefile new file mode 100644 index 0000000..32eae08 --- /dev/null +++ b/doodads/on-off/Makefile @@ -0,0 +1,18 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "State Button" blue-button.png orange-button.png state-button.doodad + doodad install-script state-button.js state-button.doodad + + doodad convert -t "State Block (Blue)" blue-on.png blue-off.png state-block-blue.doodad + doodad install-script state-block-blue.js state-block-blue.doodad + + doodad convert -t "State Block (Orange)" orange-off.png orange-on.png state-block-orange.doodad + doodad install-script state-block-orange.js state-block-orange.doodad + + for i in *.doodad; do\ + doodad edit-doodad --tag "category=gizmos" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/on-off/blue-button.png b/doodads/on-off/blue-button.png new file mode 100644 index 0000000..9df37be Binary files /dev/null and b/doodads/on-off/blue-button.png differ diff --git a/doodads/on-off/blue-off.png b/doodads/on-off/blue-off.png new file mode 100644 index 0000000..1375fe6 Binary files /dev/null and b/doodads/on-off/blue-off.png differ diff --git a/doodads/on-off/blue-on.png b/doodads/on-off/blue-on.png new file mode 100644 index 0000000..20cc9ba Binary files /dev/null and b/doodads/on-off/blue-on.png differ diff --git a/doodads/on-off/orange-button.png b/doodads/on-off/orange-button.png new file mode 100644 index 0000000..fbf2cde Binary files /dev/null and b/doodads/on-off/orange-button.png differ diff --git a/doodads/on-off/orange-off.png b/doodads/on-off/orange-off.png new file mode 100644 index 0000000..e2fa95e Binary files /dev/null and b/doodads/on-off/orange-off.png differ diff --git a/doodads/on-off/orange-on.png b/doodads/on-off/orange-on.png new file mode 100644 index 0000000..0aaae44 Binary files /dev/null and b/doodads/on-off/orange-on.png differ diff --git a/doodads/on-off/state-block-blue.js b/doodads/on-off/state-block-blue.js new file mode 100644 index 0000000..b754ea7 --- /dev/null +++ b/doodads/on-off/state-block-blue.js @@ -0,0 +1,23 @@ +// Blue State Block +function main() { + Self.SetHitbox(0, 0, 42, 42); + + // Blue block is ON by default. + var state = true; + + Message.Subscribe("broadcast:state-change", function(newState) { + state = !newState; + + // Layer 0: ON + // Layer 1: OFF + Self.ShowLayer(state ? 0 : 1); + }); + + Events.OnCollide(function(e) { + if (e.Actor.IsMobile() && e.InHitbox) { + if (state) { + return false; + } + } + }); +} diff --git a/doodads/on-off/state-block-orange.js b/doodads/on-off/state-block-orange.js new file mode 100644 index 0000000..8989f73 --- /dev/null +++ b/doodads/on-off/state-block-orange.js @@ -0,0 +1,23 @@ +// Orange State Block +function main() { + Self.SetHitbox(0, 0, 42, 42); + + // Orange block is OFF by default. + var state = false; + + Message.Subscribe("broadcast:state-change", function(newState) { + state = newState; + + // Layer 0: OFF + // Layer 1: ON + Self.ShowLayer(state ? 1 : 0); + }); + + Events.OnCollide(function(e) { + if (e.Actor.IsMobile() && e.InHitbox) { + if (state) { + return false; + } + } + }); +} diff --git a/doodads/on-off/state-button.js b/doodads/on-off/state-button.js new file mode 100644 index 0000000..f0b02a6 --- /dev/null +++ b/doodads/on-off/state-button.js @@ -0,0 +1,55 @@ +// State Block Control Button + +// Button is "OFF" by default. +var state = false; + +function main() { + Self.SetHitbox(0, 0, 42, 42); + + // When the button is activated, don't keep toggling state until we're not + // being touched again. + var colliding = false; + + // If we receive a state change event from a DIFFERENT on/off button, update + // ourself to match the state received. + Message.Subscribe("broadcast:state-change", function(value) { + state = value; + showSprite(); + }); + + Events.OnCollide(function(e) { + if (colliding) { + return false; + } + + // Only trigger for mobile characters. + if (e.Actor.IsMobile()) { + // Only activate if touched from the bottom or sides. + if (e.Overlap.Y === 0) { + return false; + } + + colliding = true; + state = !state; + Message.Broadcast("broadcast:state-change", state); + + showSprite(); + } + + // Always a solid button. + return false; + }); + + Events.OnLeave(function(e) { + colliding = false; + }) +} + +// Update the active layer based on the current button state. +function showSprite() { + if (state) { + Self.ShowLayer(1); + } else { + Self.ShowLayer(0); + } +} diff --git a/doodads/palette.json b/doodads/palette.json new file mode 100644 index 0000000..a2f9e19 --- /dev/null +++ b/doodads/palette.json @@ -0,0 +1,35 @@ +{ + "#000000": { + "name": "black" + }, + "#666666": { + "name": "dark-grey" + }, + "#999999": { + "name": "grey" + }, + "#CCCCCC": { + "name": "light-grey" + }, + "#FF0000": { + "name": "red" + }, + "#0099FF": { + "name": "light-blue" + }, + "#0000FF": { + "name": "blue" + }, + "#009900": { + "name": "green" + }, + "#999900": { + "name": "gold" + }, + "#4D391B": { + "name": "brown" + }, + "#8B652C": { + "name": "light-brown" + } +} diff --git a/doodads/regions/Makefile b/doodads/regions/Makefile new file mode 100644 index 0000000..7d8c6b2 --- /dev/null +++ b/doodads/regions/Makefile @@ -0,0 +1,29 @@ +ALL: build + +.PHONY: build +build: + # Goal Region + doodad convert -t "Goal Region" goal-128.png reg-goal.doodad + doodad install-script goal.js reg-goal.doodad + + # Checkpoint Region + doodad convert -t "Checkpoint Region" checkpoint-128.png reg-checkpoint.doodad + doodad install-script checkpoint.js reg-checkpoint.doodad + + # Fire Region + doodad convert -t "Fire Region" fire-128.png reg-fire.doodad + doodad install-script fire.js reg-fire.doodad + + # Stall Region + doodad convert -t "Stall Player (250ms)" stall-128.png reg-stall-250.doodad + doodad edit-doodad --tag "ms=250" reg-stall-250.doodad + doodad install-script stall.js reg-stall-250.doodad + + # Power Source + doodad convert -t "Power Source" power-64.png power-source.doodad + doodad install-script power.js power-source.doodad + + for i in *.doodad; do\ + doodad edit-doodad --tag "category=technical" $${i};\ + done + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/regions/checkpoint-128.png b/doodads/regions/checkpoint-128.png new file mode 100644 index 0000000..bc1c34e Binary files /dev/null and b/doodads/regions/checkpoint-128.png differ diff --git a/doodads/regions/checkpoint.js b/doodads/regions/checkpoint.js new file mode 100644 index 0000000..47f5669 --- /dev/null +++ b/doodads/regions/checkpoint.js @@ -0,0 +1,38 @@ +// Checkpoint Region +// Acts like an invisible checkpoint flag. +var isCurrentCheckpoint = false; + +function main() { + Self.Hide(); + setActive(false); + + // Checkpoints broadcast to all of their peers so they all + // know which one is the most recently activated. + Message.Subscribe("broadcast:checkpoint", function (currentID) { + setActive(false); + }); + + Events.OnCollide(function (e) { + if (isCurrentCheckpoint || !e.Settled) { + return; + } + + // Only care about the player character. + if (!e.Actor.IsPlayer()) { + return; + } + + // Set the player checkpoint. + SetCheckpoint(Self.Position()); + setActive(true); + Message.Broadcast("broadcast:checkpoint", Self.ID()) + }); +} + +function setActive(v) { + if (v && !isCurrentCheckpoint) { + Flash("Checkpoint!"); + } + + isCurrentCheckpoint = v; +} \ No newline at end of file diff --git a/doodads/regions/fire-128.png b/doodads/regions/fire-128.png new file mode 100644 index 0000000..117a231 Binary files /dev/null and b/doodads/regions/fire-128.png differ diff --git a/doodads/regions/fire.js b/doodads/regions/fire.js new file mode 100644 index 0000000..aae40c8 --- /dev/null +++ b/doodads/regions/fire.js @@ -0,0 +1,19 @@ +// Goal Region. +function main() { + Self.Hide(); + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + // Only care if it's the player. + if (!e.Actor.IsPlayer()) { + return; + } + + if (e.InHitbox) { + FailLevel("You have died!"); + } + }); +} diff --git a/doodads/regions/goal-128.png b/doodads/regions/goal-128.png new file mode 100644 index 0000000..b769917 Binary files /dev/null and b/doodads/regions/goal-128.png differ diff --git a/doodads/regions/goal.js b/doodads/regions/goal.js new file mode 100644 index 0000000..1d06f8f --- /dev/null +++ b/doodads/regions/goal.js @@ -0,0 +1,19 @@ +// Goal Region. +function main() { + Self.Hide(); + + Events.OnCollide(function (e) { + if (!e.Settled) { + return; + } + + // Only care if it's the player. + if (!e.Actor.IsPlayer()) { + return; + } + + if (e.InHitbox) { + EndLevel(); + } + }); +} diff --git a/doodads/regions/power-128.png b/doodads/regions/power-128.png new file mode 100644 index 0000000..fcdab41 Binary files /dev/null and b/doodads/regions/power-128.png differ diff --git a/doodads/regions/power-64.png b/doodads/regions/power-64.png new file mode 100644 index 0000000..cfe47f5 Binary files /dev/null and b/doodads/regions/power-64.png differ diff --git a/doodads/regions/power.js b/doodads/regions/power.js new file mode 100644 index 0000000..072a526 --- /dev/null +++ b/doodads/regions/power.js @@ -0,0 +1,22 @@ +// Power source. +// Emits a power(true) signal once on level start. +// If it receives a power signal, it will repeat it after 5 seconds. +// Link two of these bad boys together and you got yourself a clock. +function main() { + Self.Hide(); + + // See if we are not linked to anything. + var links = Self.GetLinks(); + if (links.length === 0) { + console.error( + "%s at %s is not linked to anything! This doodad emits a power(true) on level start to all linked doodads.", + Self.Title, + Self.Position() + ); + } + + Message.Subscribe("broadcast:ready", function () { + Message.Publish("switch:toggle", true); + Message.Publish("power", true); + }); +} diff --git a/doodads/regions/stall-128.png b/doodads/regions/stall-128.png new file mode 100644 index 0000000..ea0bd5e Binary files /dev/null and b/doodads/regions/stall-128.png differ diff --git a/doodads/regions/stall.js b/doodads/regions/stall.js new file mode 100644 index 0000000..c174594 --- /dev/null +++ b/doodads/regions/stall.js @@ -0,0 +1,40 @@ +// Stall Player. +// Tags: ms (int) +// Grabs the player one time. Resets if it receives power. +function main() { + Self.Hide(); + + var active = true, + timeout = 250, + ms = Self.GetTag("ms"); + + if (ms.length > 0) { + timeout = parseInt(ms); + } + + Events.OnCollide(function (e) { + if (!active || !e.Settled) { + return; + } + + // Only care if it's the player. + if (!e.Actor.IsPlayer()) { + return; + } + + if (e.InHitbox) { + // Grab hold of the player. + e.Actor.Freeze(); + setTimeout(function () { + e.Actor.Unfreeze(); + }, timeout); + + active = false; + } + }); + + // Reset the trap if powered by a button. + Message.Subscribe("power", function (powered) { + active = true; + }); +} diff --git a/doodads/switches/Makefile b/doodads/switches/Makefile new file mode 100644 index 0000000..b603c1f --- /dev/null +++ b/doodads/switches/Makefile @@ -0,0 +1,20 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Switch" switch-off.png switch-on.png switch.doodad + doodad convert -t "Floor Switch" down-off.png down-on.png switch-down.doodad + doodad convert -t "Left Switch" left-off.png left-on.png switch-left.doodad + doodad convert -t "Right Switch" right-off.png right-on.png switch-right.doodad + + doodad install-script switch.js switch.doodad + doodad install-script switch.js switch-down.doodad + doodad install-script switch.js switch-left.doodad + doodad install-script switch.js switch-right.doodad + + # Tag the category for these doodads + for i in *.doodad; do\ + doodad edit-doodad --tag "category=gizmos" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/switches/down-off.png b/doodads/switches/down-off.png new file mode 100644 index 0000000..2b08ca0 Binary files /dev/null and b/doodads/switches/down-off.png differ diff --git a/doodads/switches/down-on.png b/doodads/switches/down-on.png new file mode 100644 index 0000000..527b2a0 Binary files /dev/null and b/doodads/switches/down-on.png differ diff --git a/doodads/switches/left-off.png b/doodads/switches/left-off.png new file mode 100644 index 0000000..33acceb Binary files /dev/null and b/doodads/switches/left-off.png differ diff --git a/doodads/switches/left-on.png b/doodads/switches/left-on.png new file mode 100644 index 0000000..36d5c45 Binary files /dev/null and b/doodads/switches/left-on.png differ diff --git a/doodads/switches/right-off.png b/doodads/switches/right-off.png new file mode 100644 index 0000000..500e65c Binary files /dev/null and b/doodads/switches/right-off.png differ diff --git a/doodads/switches/right-on.png b/doodads/switches/right-on.png new file mode 100644 index 0000000..c5a196e Binary files /dev/null and b/doodads/switches/right-on.png differ diff --git a/doodads/switches/switch-off.png b/doodads/switches/switch-off.png new file mode 100644 index 0000000..4e7c006 Binary files /dev/null and b/doodads/switches/switch-off.png differ diff --git a/doodads/switches/switch-on.png b/doodads/switches/switch-on.png new file mode 100644 index 0000000..bb191ce Binary files /dev/null and b/doodads/switches/switch-on.png differ diff --git a/doodads/switches/switch.js b/doodads/switches/switch.js new file mode 100644 index 0000000..973a7b3 --- /dev/null +++ b/doodads/switches/switch.js @@ -0,0 +1,45 @@ +function main() { + + // Switch has two frames: + // 0: Off + // 1: On + + var state = false; + var collide = false; + + Message.Subscribe("power", function (powered) { + state = powered; + showState(state); + }); + + Events.OnCollide(function (e) { + if (!e.Settled || !e.Actor.IsMobile()) { + return; + } + + if (collide === false) { + Sound.Play("button-down.wav") + state = !state; + + var nonce = Math.random() * 2147483647; + Message.Publish("switch:toggle", state); + Message.Publish("power", state); + showState(state); + + collide = true; + } + }); + + Events.OnLeave(function (e) { + collide = false; + }); +} + +// showState shows the on/off frame based on the boolean powered state. +function showState(state) { + if (state) { + Self.ShowLayer(1); + } else { + Self.ShowLayer(0); + } +} diff --git a/doodads/test/index.js b/doodads/test/index.js new file mode 100644 index 0000000..07ee2f7 --- /dev/null +++ b/doodads/test/index.js @@ -0,0 +1,13 @@ +// Test Doodad Script +function main() { + console.log("I am actor ID " + Self.ID()); + + // Set our doodad's background color to pink. It will be turned + // red whenever something collides with us. + Self.Canvas.SetBackground(RGBA(255, 153, 255, 153)); + + Events.OnCollide( function(e) { + console.log("Collided with something!"); + Self.Canvas.SetBackground(RGBA(255, 0, 0, 153)); + }); +} diff --git a/doodads/thief/Makefile b/doodads/thief/Makefile new file mode 100644 index 0000000..1d7a149 --- /dev/null +++ b/doodads/thief/Makefile @@ -0,0 +1,14 @@ +SHELL = /bin/bash + +ALL: build + +.PHONY: build +build: + doodad convert -t "Thief" stand-right.png stand-left.png \ + walk-right-{1,2,3}.png walk-left-{1,2,3}.png \ + thief.doodad + doodad install-script thief.js thief.doodad + + doodad edit-doodad --tag "category=creatures" thief.doodad + + cp *.doodad ../../../assets/doodads/ diff --git a/doodads/thief/stand-left.png b/doodads/thief/stand-left.png new file mode 100644 index 0000000..9dc96b5 Binary files /dev/null and b/doodads/thief/stand-left.png differ diff --git a/doodads/thief/stand-right.png b/doodads/thief/stand-right.png new file mode 100644 index 0000000..96b5f13 Binary files /dev/null and b/doodads/thief/stand-right.png differ diff --git a/doodads/thief/thief.js b/doodads/thief/thief.js new file mode 100644 index 0000000..bdc945a --- /dev/null +++ b/doodads/thief/thief.js @@ -0,0 +1,130 @@ +// Thief + +function main() { + Self.SetMobile(true); + Self.SetGravity(true); + Self.SetInventory(true); + Self.SetHitbox(0, 0, 32, 58); + Self.AddAnimation("walk-left", 200, ["stand-left", "walk-left-1", "walk-left-2", "walk-left-3", "walk-left-2", "walk-left-1"]); + Self.AddAnimation("walk-right", 200, ["stand-right", "walk-right-1", "walk-right-2", "walk-right-3", "walk-right-2", "walk-right-1"]); + + // All thieves can steal items. + stealable(); + + // Controlled by the player character? + if (Self.IsPlayer()) { + return playable(); + } + return ai(); +} + +// Common "steal" power between playable and A.I. thieves. +function stealable() { + // Steals your items. + Events.OnCollide(function (e) { + var victim = e.Actor; + if (!e.Settled) { + return; + } + + // Thieves don't steal from Thieves (unless controlled by the player). + if (!Self.IsPlayer() && victim.Drawing.Doodad.Filename === "thief.doodad") { + return; + } + + // Steal inventory + var stolen = 0; + if (victim.HasInventory()) { + var myInventory = Self.Inventory(), + theirInventory = victim.Inventory(); + + for (var key in theirInventory) { + if (!theirInventory.hasOwnProperty(key)) { + continue; + } + + var value = theirInventory[key]; + if (value > 0 || myInventory[key] === undefined) { + victim.RemoveItem(key, value); + Self.AddItem(key, value); + stolen += (value === 0 ? 1 : value); + } + } + + // If the player lost their items, notify them. + if (victim.IsPlayer() && stolen > 0) { + Flash("Watch out for thieves! %d item%s stolen!", parseInt(stolen), stolen === 1 ? ' was' : 's were'); + } + + // If the Thief IS the player, notify your earnings. + if (Self.IsPlayer() && stolen > 0) { + Flash("Awesome! Stole %d item%s from the %s!", parseInt(stolen), stolen === 1 ? '' : 's', e.Actor.Drawing.Doodad.Title); + } + } + }); +} + +// Enemy Doodad AI: walks back and forth, changing direction +// when it encounters and obstacle. +function ai() { + // Walks back and forth. + var Vx = Vy = 0.0, + playerSpeed = 4, + direction = "right", + lastDirection = "right", + lastSampledX = 0, + sampleTick = 0, + sampleRate = 2; + + setInterval(function () { + if (sampleTick % sampleRate === 0) { + var curX = Self.Position().X, + delta = Math.abs(curX - lastSampledX); + if (delta < 5) { + direction = direction === "right" ? "left" : "right"; + } + lastSampledX = curX; + } + sampleTick++; + + Vx = parseFloat(playerSpeed * (direction === "left" ? -1 : 1)); + Self.SetVelocity(Vector(Vx, Vy)); + + // If we changed directions, stop animating now so we can + // turn around quickly without moonwalking. + if (direction !== lastDirection) { + Self.StopAnimation(); + } + + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-" + direction, null); + } + + lastDirection = direction; + }, 100); +} + +// If under control of the player character. +function playable() { + Events.OnKeypress(function (ev) { + Vx = 0; + Vy = 0; + + if (ev.Right) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-right", null); + } + Vx = playerSpeed; + } else if (ev.Left) { + if (!Self.IsAnimating()) { + Self.PlayAnimation("walk-left", null); + } + Vx = -playerSpeed; + } else { + Self.StopAnimation(); + animating = false; + } + + // Self.SetVelocity(Point(Vx, Vy)); + }) +} \ No newline at end of file diff --git a/doodads/thief/walk-left-1.png b/doodads/thief/walk-left-1.png new file mode 100644 index 0000000..5e0e16d Binary files /dev/null and b/doodads/thief/walk-left-1.png differ diff --git a/doodads/thief/walk-left-2.png b/doodads/thief/walk-left-2.png new file mode 100644 index 0000000..402e8d0 Binary files /dev/null and b/doodads/thief/walk-left-2.png differ diff --git a/doodads/thief/walk-left-3.png b/doodads/thief/walk-left-3.png new file mode 100644 index 0000000..352a45c Binary files /dev/null and b/doodads/thief/walk-left-3.png differ diff --git a/doodads/thief/walk-right-1.png b/doodads/thief/walk-right-1.png new file mode 100644 index 0000000..138d9a4 Binary files /dev/null and b/doodads/thief/walk-right-1.png differ diff --git a/doodads/thief/walk-right-2.png b/doodads/thief/walk-right-2.png new file mode 100644 index 0000000..2e33928 Binary files /dev/null and b/doodads/thief/walk-right-2.png differ diff --git a/doodads/thief/walk-right-3.png b/doodads/thief/walk-right-3.png new file mode 100644 index 0000000..e0b6244 Binary files /dev/null and b/doodads/thief/walk-right-3.png differ diff --git a/doodads/trapdoors/Makefile b/doodads/trapdoors/Makefile new file mode 100644 index 0000000..596c1b2 --- /dev/null +++ b/doodads/trapdoors/Makefile @@ -0,0 +1,34 @@ +SHELL = /bin/bash + +ALL: build + +.PHONY: build +build: + # Build the four basic trapdoors. + doodad convert -t "Trapdoor" down{1,2,3,4}.png trapdoor-down.doodad + doodad convert -t "Trapdoor Left" left{1,2,3,4}.png trapdoor-left.doodad + doodad convert -t "Trapdoor Right" right{1,2,3,4}.png trapdoor-right.doodad + doodad convert -t "Trapdoor Up" up{1,2,3,4}.png trapdoor-up.doodad + doodad install-script trapdoor.js trapdoor-down.doodad + doodad install-script trapdoor.js trapdoor-left.doodad + doodad install-script trapdoor.js trapdoor-right.doodad + doodad install-script trapdoor.js trapdoor-up.doodad + + doodad edit-doodad -q --tag direction=down trapdoor-down.doodad + doodad edit-doodad -q --tag direction=left trapdoor-left.doodad + doodad edit-doodad -q --tag direction=right trapdoor-right.doodad + doodad edit-doodad -q --tag direction=up trapdoor-up.doodad + + # Tag the category for these doodads + ls -hal *.doodad + for i in *.doodad; do\ + echo $${i};\ + doodad edit-doodad -q --tag "category=doors" $${i};\ + done + + # Build the Electric Trapdoor. + doodad convert -t "Electric Trapdoor" electric{1,2,3,4}.png electric-trapdoor.doodad + doodad install-script electric-trapdoor.js electric-trapdoor.doodad + doodad edit-doodad -q --tag "category=doors,gizmos" electric-trapdoor.doodad + + cp *.doodad ../../../assets/doodads/ diff --git a/doodads/trapdoors/README.md b/doodads/trapdoors/README.md new file mode 100644 index 0000000..02d30b2 --- /dev/null +++ b/doodads/trapdoors/README.md @@ -0,0 +1,5 @@ +# Button Doodads + +```bash +doodad convert -t "Trapdoor Down" down{1,2,3}.png trapdoor-down.doodad +``` diff --git a/doodads/trapdoors/down.gif b/doodads/trapdoors/down.gif new file mode 100644 index 0000000..07a1fc9 Binary files /dev/null and b/doodads/trapdoors/down.gif differ diff --git a/doodads/trapdoors/down.js b/doodads/trapdoors/down.js new file mode 100644 index 0000000..3ea5fba --- /dev/null +++ b/doodads/trapdoors/down.js @@ -0,0 +1,36 @@ +function main() { + var timer = 0; + + Self.SetHitbox(0, 0, 72, 6); + + var animationSpeed = 100; + var opened = false; + Self.AddAnimation("open", animationSpeed, ["down1", "down2", "down3", "down4"]); + Self.AddAnimation("close", animationSpeed, ["down4", "down3", "down2", "down1"]); + + Events.OnCollide( function(e) { + if (opened) { + return; + } + + // Is the actor colliding our solid part? + if (e.InHitbox) { + // Touching the top or the bottom? + if (e.Overlap.Y > 0) { + return false; // solid wall when touched from below + } else { + opened = true; + Self.PlayAnimation("open", function() { + }); + } + } + }); + + Events.OnLeave(function() { + if (opened) { + Self.PlayAnimation("close", function() { + opened = false; + }); + } + }) +} diff --git a/doodads/trapdoors/down1.png b/doodads/trapdoors/down1.png new file mode 100644 index 0000000..f4871d5 Binary files /dev/null and b/doodads/trapdoors/down1.png differ diff --git a/doodads/trapdoors/down2.png b/doodads/trapdoors/down2.png new file mode 100644 index 0000000..62adb46 Binary files /dev/null and b/doodads/trapdoors/down2.png differ diff --git a/doodads/trapdoors/down3.png b/doodads/trapdoors/down3.png new file mode 100644 index 0000000..6c1f191 Binary files /dev/null and b/doodads/trapdoors/down3.png differ diff --git a/doodads/trapdoors/down4.png b/doodads/trapdoors/down4.png new file mode 100644 index 0000000..a15da36 Binary files /dev/null and b/doodads/trapdoors/down4.png differ diff --git a/doodads/trapdoors/electric-trapdoor.js b/doodads/trapdoors/electric-trapdoor.js new file mode 100644 index 0000000..836f662 --- /dev/null +++ b/doodads/trapdoors/electric-trapdoor.js @@ -0,0 +1,65 @@ +// Electric Trapdoor + +var animationSpeed = 100, + spriteWidth = 114, + thickness = 7, + isOpen = false, + animating = false, + powerState = false; + +function main() { + Self.SetHitbox(0, 2, spriteWidth, thickness); + + Self.AddAnimation("open", animationSpeed, [0, 1, 2, 3]); + Self.AddAnimation("close", animationSpeed, [3, 2, 1, 0]); + + // Subscribe to Switches and other power sources. Note: if a + // switch toggles us, we ignore the immediately following + // power signal which will be coming from the same switch. + // The electric trapdoor always toggles when hit by a switch. + var ignoreNextPower = false; + Message.Subscribe("switch:toggle", function (powered) { + ignoreNextPower = true + setPoweredState(!powerState); + }); + Message.Subscribe("power", function (powered) { + if (ignoreNextPower) { + ignoreNextPower = false; + return; + } + setPoweredState(powered); + }); + + Events.OnCollide(function (e) { + if (e.InHitbox && !isOpen) { + return false; + } + }) +} + +function setPoweredState(powered) { + powerState = powered; + + if (powered) { + if (animating || isOpen) { + return; + } + + animating = true; + Self.PlayAnimation("open", function () { + isOpen = true; + animating = false; + + // Had we lost power quickly? + if (!powerState) { + setPoweredState(false); + } + }); + } else { + animating = true; + Self.PlayAnimation("close", function () { + isOpen = false; + animating = false; + }); + } +} diff --git a/doodads/trapdoors/electric1.png b/doodads/trapdoors/electric1.png new file mode 100644 index 0000000..bc9138f Binary files /dev/null and b/doodads/trapdoors/electric1.png differ diff --git a/doodads/trapdoors/electric2.png b/doodads/trapdoors/electric2.png new file mode 100644 index 0000000..139d9c8 Binary files /dev/null and b/doodads/trapdoors/electric2.png differ diff --git a/doodads/trapdoors/electric3.png b/doodads/trapdoors/electric3.png new file mode 100644 index 0000000..6b33049 Binary files /dev/null and b/doodads/trapdoors/electric3.png differ diff --git a/doodads/trapdoors/electric4.png b/doodads/trapdoors/electric4.png new file mode 100644 index 0000000..97b9bac Binary files /dev/null and b/doodads/trapdoors/electric4.png differ diff --git a/doodads/trapdoors/left1.png b/doodads/trapdoors/left1.png new file mode 100644 index 0000000..6bb04d2 Binary files /dev/null and b/doodads/trapdoors/left1.png differ diff --git a/doodads/trapdoors/left2.png b/doodads/trapdoors/left2.png new file mode 100644 index 0000000..cd29dd5 Binary files /dev/null and b/doodads/trapdoors/left2.png differ diff --git a/doodads/trapdoors/left3.png b/doodads/trapdoors/left3.png new file mode 100644 index 0000000..b7cbb41 Binary files /dev/null and b/doodads/trapdoors/left3.png differ diff --git a/doodads/trapdoors/left4.png b/doodads/trapdoors/left4.png new file mode 100644 index 0000000..dec5a61 Binary files /dev/null and b/doodads/trapdoors/left4.png differ diff --git a/doodads/trapdoors/right1.png b/doodads/trapdoors/right1.png new file mode 100644 index 0000000..5ac6228 Binary files /dev/null and b/doodads/trapdoors/right1.png differ diff --git a/doodads/trapdoors/right2.png b/doodads/trapdoors/right2.png new file mode 100644 index 0000000..e7f33d4 Binary files /dev/null and b/doodads/trapdoors/right2.png differ diff --git a/doodads/trapdoors/right3.png b/doodads/trapdoors/right3.png new file mode 100644 index 0000000..88ee3db Binary files /dev/null and b/doodads/trapdoors/right3.png differ diff --git a/doodads/trapdoors/right4.png b/doodads/trapdoors/right4.png new file mode 100644 index 0000000..8c0d01d Binary files /dev/null and b/doodads/trapdoors/right4.png differ diff --git a/doodads/trapdoors/trapdoor.js b/doodads/trapdoors/trapdoor.js new file mode 100644 index 0000000..54dca12 --- /dev/null +++ b/doodads/trapdoors/trapdoor.js @@ -0,0 +1,88 @@ +function main() { + // What direction is the trapdoor facing? + var direction = Self.GetTag("direction"); + + var timer = 0; + + // Set our hitbox based on our orientation. + var thickness = 10; + var doodadSize = 86; + if (direction === "left") { + Self.SetHitbox(48, 0, doodadSize, doodadSize); + } else if (direction === "right") { + Self.SetHitbox(0, 0, thickness, doodadSize); + } else if (direction === "up") { + Self.SetHitbox(0, doodadSize - thickness, doodadSize, doodadSize); + } else { // Down, default. + Self.SetHitbox(0, 0, doodadSize, thickness); + } + + var animationSpeed = 100; + var opened = false; + + // Register our animations. + var frames = []; + for (var i = 1; i <= 4; i++) { + frames.push(direction + i); + } + + Self.AddAnimation("open", animationSpeed, frames); + frames.reverse(); + Self.AddAnimation("close", animationSpeed, frames); + + Events.OnCollide( function(e) { + if (opened) { + return; + } + + // Is the actor colliding our solid part? + if (e.InHitbox) { + // Are they touching our opening side? + if (direction === "left") { + if (doodadSize - e.Overlap.X < thickness) { + // Touching the right edge, open the door. + opened = true; + Self.PlayAnimation("open", null); + return; + } + if (e.Overlap.W === doodadSize - thickness) { + return false; + } + } else if (direction === "right") { + if (e.Overlap.X > 0) { + return false; + } else if (e.Settled) { + opened = true; + Self.PlayAnimation("open", null); + } + } else if (direction === "up") { + if (doodadSize - e.Overlap.Y < thickness) { + // Touching the bottom edge, open the door. + opened = true; + Self.PlayAnimation("open", null); + return; + } + if (e.Overlap.H === doodadSize - thickness) { + return false; + } + } else if (direction === "down") { + if (e.Overlap.Y > 0) { + return false; + } else if (e.Settled) { + opened = true; + Self.PlayAnimation("open", null); + } + } + + return true; + } + }); + + Events.OnLeave(function() { + if (opened) { + Self.PlayAnimation("close", function() { + opened = false; + }); + } + }) +} diff --git a/doodads/trapdoors/up1.png b/doodads/trapdoors/up1.png new file mode 100644 index 0000000..bc7830c Binary files /dev/null and b/doodads/trapdoors/up1.png differ diff --git a/doodads/trapdoors/up2.png b/doodads/trapdoors/up2.png new file mode 100644 index 0000000..bd92a0c Binary files /dev/null and b/doodads/trapdoors/up2.png differ diff --git a/doodads/trapdoors/up3.png b/doodads/trapdoors/up3.png new file mode 100644 index 0000000..a18640e Binary files /dev/null and b/doodads/trapdoors/up3.png differ diff --git a/doodads/trapdoors/up4.png b/doodads/trapdoors/up4.png new file mode 100644 index 0000000..dc68a2d Binary files /dev/null and b/doodads/trapdoors/up4.png differ diff --git a/doodads/warp-door/Makefile b/doodads/warp-door/Makefile new file mode 100644 index 0000000..a4842e1 --- /dev/null +++ b/doodads/warp-door/Makefile @@ -0,0 +1,26 @@ +ALL: build + +.PHONY: build +build: + doodad convert -t "Warp Door" door-1.png door-2.png door-3.png door-4.png warp-door.doodad + doodad edit-doodad -q --tag color=none warp-door.doodad + doodad install-script warp-door.js warp-door.doodad + + doodad convert -t "Warp Door (Blue)" blue-1.png blue-2.png blue-3.png blue-4.png blue-off.png \ + warp-door-blue.doodad + doodad edit-doodad -q --tag color=blue warp-door-blue.doodad + doodad install-script warp-door.js warp-door-blue.doodad + + doodad convert -t "Warp Door (Orange)" orange-off.png orange-1.png orange-2.png orange-3.png orange-4.png \ + warp-door-orange.doodad + doodad edit-doodad -q --tag color=orange warp-door-orange.doodad + doodad install-script warp-door.js warp-door-orange.doodad + + for i in *.doodad; do\ + doodad edit-doodad --tag "category=doors" $${i};\ + done + for i in warp-door-*.doodad; do\ + doodad edit-doodad --tag "category=doors,gizmos" $${i};\ + done + + cp *.doodad ../../../assets/doodads/ \ No newline at end of file diff --git a/doodads/warp-door/blue-1.png b/doodads/warp-door/blue-1.png new file mode 100644 index 0000000..4921faf Binary files /dev/null and b/doodads/warp-door/blue-1.png differ diff --git a/doodads/warp-door/blue-2.png b/doodads/warp-door/blue-2.png new file mode 100644 index 0000000..ca96abf Binary files /dev/null and b/doodads/warp-door/blue-2.png differ diff --git a/doodads/warp-door/blue-3.png b/doodads/warp-door/blue-3.png new file mode 100644 index 0000000..1a1e75c Binary files /dev/null and b/doodads/warp-door/blue-3.png differ diff --git a/doodads/warp-door/blue-4.png b/doodads/warp-door/blue-4.png new file mode 100644 index 0000000..f676890 Binary files /dev/null and b/doodads/warp-door/blue-4.png differ diff --git a/doodads/warp-door/blue-off.png b/doodads/warp-door/blue-off.png new file mode 100644 index 0000000..a42b51c Binary files /dev/null and b/doodads/warp-door/blue-off.png differ diff --git a/doodads/warp-door/door-1.png b/doodads/warp-door/door-1.png new file mode 100644 index 0000000..e057d24 Binary files /dev/null and b/doodads/warp-door/door-1.png differ diff --git a/doodads/warp-door/door-2.png b/doodads/warp-door/door-2.png new file mode 100644 index 0000000..71d0b61 Binary files /dev/null and b/doodads/warp-door/door-2.png differ diff --git a/doodads/warp-door/door-3.png b/doodads/warp-door/door-3.png new file mode 100644 index 0000000..d225a8d Binary files /dev/null and b/doodads/warp-door/door-3.png differ diff --git a/doodads/warp-door/door-4.png b/doodads/warp-door/door-4.png new file mode 100644 index 0000000..65f3e03 Binary files /dev/null and b/doodads/warp-door/door-4.png differ diff --git a/doodads/warp-door/orange-1.png b/doodads/warp-door/orange-1.png new file mode 100644 index 0000000..01a6a61 Binary files /dev/null and b/doodads/warp-door/orange-1.png differ diff --git a/doodads/warp-door/orange-2.png b/doodads/warp-door/orange-2.png new file mode 100644 index 0000000..2bb01fb Binary files /dev/null and b/doodads/warp-door/orange-2.png differ diff --git a/doodads/warp-door/orange-3.png b/doodads/warp-door/orange-3.png new file mode 100644 index 0000000..1983e86 Binary files /dev/null and b/doodads/warp-door/orange-3.png differ diff --git a/doodads/warp-door/orange-4.png b/doodads/warp-door/orange-4.png new file mode 100644 index 0000000..f8c08b2 Binary files /dev/null and b/doodads/warp-door/orange-4.png differ diff --git a/doodads/warp-door/orange-off.png b/doodads/warp-door/orange-off.png new file mode 100644 index 0000000..476703a Binary files /dev/null and b/doodads/warp-door/orange-off.png differ diff --git a/doodads/warp-door/warp-door.js b/doodads/warp-door/warp-door.js new file mode 100644 index 0000000..0cb6e1a --- /dev/null +++ b/doodads/warp-door/warp-door.js @@ -0,0 +1,116 @@ +// 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'; + var state = color === 'blue'; // Blue door is ON by default. + + var animating = false; + var collide = false; + + // Declare animations and sprite names. + var animSpeed = 100; + var spriteDefault, spriteDisabled; // the latter for state doors. + if (color === 'blue') { + Self.AddAnimation("open", animSpeed, ["blue-2", "blue-3", "blue-4"]); + Self.AddAnimation("close", animSpeed, ["blue-4", "blue-3", "blue-2", "blue-1"]); + spriteDefault = "blue-1"; + spriteDisabled = "blue-off"; + } else if (color === 'orange') { + Self.AddAnimation("open", animSpeed, ["orange-2", "orange-3", "orange-4"]); + Self.AddAnimation("close", animSpeed, ["orange-4", "orange-3", "orange-2", "orange-1"]); + spriteDefault = "orange-1"; + spriteDisabled = "orange-off"; + } else { + Self.AddAnimation("open", animSpeed, ["door-2", "door-3", "door-4"]); + Self.AddAnimation("close", animSpeed, ["door-4", "door-3", "door-2", "door-1"]); + spriteDefault = "door-1"; + } + + // Find our linked Warp Door. + var links = Self.GetLinks() + var linkedDoor = null; + for (var i = 0; i < links.length; i++) { + if (links[i].Title.indexOf("Warp Door") > -1) { + linkedDoor = links[i]; + } + } + + // Subscribe to the global state-change if we are a state door. + if (isStateDoor) { + Message.Subscribe("broadcast:state-change", function(newState) { + state = color === 'blue' ? !newState : newState; + + // Activate or deactivate the door. + Self.ShowLayerNamed(state ? spriteDefault : spriteDisabled); + }); + } + + // The player Uses the door. + var flashedCooldown = false; // "Locked Door" flashed message. + Events.OnUse(function(e) { + if (animating) { + return; + } + + // Doors without linked exits are not usable. + if (linkedDoor === null) { + if (!flashedCooldown) { + Flash("This door is locked."); + flashedCooldown = true; + setTimeout(function() { + flashedCooldown = false; + }, 1000); + } + return; + } + + // Only players can use doors for now. + if (e.Actor.IsPlayer()) { + if (isStateDoor && !state) { + // The state door is inactive (dotted outline). + return; + } + + // Freeze the player. + e.Actor.Freeze() + + // Play the open and close animation. + animating = true; + Self.PlayAnimation("open", function() { + e.Actor.Hide() + Self.PlayAnimation("close", function() { + Self.ShowLayerNamed(isStateDoor && !state ? spriteDisabled : spriteDefault); + animating = false; + + // Teleport the player to the linked door. Inform the target + // door of the arrival of the player so it doesn't trigger + // to send the player back here again on a loop. + if (linkedDoor !== null) { + Message.Publish("warp-door:incoming", e.Actor); + e.Actor.MoveTo(linkedDoor.Position()); + } + }); + }); + } + }); + + // Respond to incoming warp events. + Message.Subscribe("warp-door:incoming", function(player) { + animating = true; + player.Unfreeze(); + Self.PlayAnimation("open", function() { + player.Show(); + Self.PlayAnimation("close", function() { + animating = false; + + // If the receiving door was a State Door, fix its state. + if (isStateDoor) { + Self.ShowLayerNamed(state ? spriteDefault : spriteDisabled); + } + }); + }); + }); +} diff --git a/levels/Castle.level b/levels/Castle.level new file mode 100644 index 0000000..795e739 Binary files /dev/null and b/levels/Castle.level differ diff --git a/levels/Desert-1of2.level b/levels/Desert-1of2.level new file mode 100644 index 0000000..09892c6 Binary files /dev/null and b/levels/Desert-1of2.level differ diff --git a/levels/Desert-2of2.level b/levels/Desert-2of2.level new file mode 100644 index 0000000..c5adeff Binary files /dev/null and b/levels/Desert-2of2.level differ diff --git a/levels/Thief 1.level b/levels/Thief 1.level new file mode 100644 index 0000000..b41fc6e Binary files /dev/null and b/levels/Thief 1.level differ diff --git a/levels/Tutorial 1.level b/levels/Tutorial 1.level new file mode 100644 index 0000000..0346b7e Binary files /dev/null and b/levels/Tutorial 1.level differ diff --git a/levels/Tutorial 2.level b/levels/Tutorial 2.level new file mode 100644 index 0000000..a8e6b5b Binary files /dev/null and b/levels/Tutorial 2.level differ diff --git a/levels/Tutorial 3.level b/levels/Tutorial 3.level new file mode 100644 index 0000000..5d52be6 Binary files /dev/null and b/levels/Tutorial 3.level differ diff --git a/wallpapers/blue-notebook.png b/wallpapers/blue-notebook.png new file mode 100644 index 0000000..4a6c1bd Binary files /dev/null and b/wallpapers/blue-notebook.png differ diff --git a/wallpapers/blueprint.png b/wallpapers/blueprint.png new file mode 100644 index 0000000..1eaf404 Binary files /dev/null and b/wallpapers/blueprint.png differ diff --git a/wallpapers/dots.png b/wallpapers/dots.png new file mode 100644 index 0000000..7dd91f3 Binary files /dev/null and b/wallpapers/dots.png differ diff --git a/wallpapers/graph.png b/wallpapers/graph.png new file mode 100644 index 0000000..9b9481d Binary files /dev/null and b/wallpapers/graph.png differ diff --git a/wallpapers/legal.png b/wallpapers/legal.png new file mode 100644 index 0000000..4af053a Binary files /dev/null and b/wallpapers/legal.png differ diff --git a/wallpapers/notebook.png b/wallpapers/notebook.png new file mode 100644 index 0000000..b8a3d1a Binary files /dev/null and b/wallpapers/notebook.png differ diff --git a/wallpapers/white.png b/wallpapers/white.png new file mode 100644 index 0000000..cbdb1c0 Binary files /dev/null and b/wallpapers/white.png differ