diff --git a/dev-assets/doodads/azulian/Makefile b/dev-assets/doodads/azulian/Makefile index 1fde043..d9e4930 100644 --- a/dev-assets/doodads/azulian/Makefile +++ b/dev-assets/doodads/azulian/Makefile @@ -14,6 +14,11 @@ build: doodad edit-doodad --tag "color=red" azu-red.doodad doodad install-script azulian.js azu-red.doodad + doodad convert -t "White Azulian" white-front.png white-back.png \ + white-wr{1,2,3,4}.png white-wl{1,2,3,4}.png azu-white.doodad + doodad edit-doodad --tag "color=white" azu-white.doodad + doodad install-script azulian.js azu-white.doodad + # Tag the category for these doodads for i in *.doodad; do\ doodad edit-doodad --tag "category=creatures" $${i};\ diff --git a/dev-assets/doodads/azulian/azulian.js b/dev-assets/doodads/azulian/azulian.js index 2a8d3e6..d34cefa 100644 --- a/dev-assets/doodads/azulian/azulian.js +++ b/dev-assets/doodads/azulian/azulian.js @@ -9,9 +9,17 @@ var playerSpeed = color === 'blue' ? 2 : 4, direction = "right", lastDirection = "right"; +// white Azulian is faster yet than the red +if (color === 'white') { + aggroX = 1000; + aggroY = 400; + playerSpeed = 8; + jumpSpeed = 16; +} + function setupAnimations(color) { - let left = color === 'blue' ? 'blu-wl' : 'red-wl', - right = color === 'blue' ? 'blu-wr' : 'red-wr', + let left = color === 'blue' ? 'blu-wl' : color+'-wl', + right = color === 'blue' ? 'blu-wr' : color+'-wr', leftFrames = [left + '1', left + '2', left + '3', left + '4'], rightFrames = [right + '1', right + '2', right + '3', right + '4']; diff --git a/dev-assets/doodads/azulian/white-back.png b/dev-assets/doodads/azulian/white-back.png new file mode 100644 index 0000000..12f0a74 Binary files /dev/null and b/dev-assets/doodads/azulian/white-back.png differ diff --git a/dev-assets/doodads/azulian/white-front.png b/dev-assets/doodads/azulian/white-front.png new file mode 100644 index 0000000..b2ffece Binary files /dev/null and b/dev-assets/doodads/azulian/white-front.png differ diff --git a/dev-assets/doodads/azulian/white-wl1.png b/dev-assets/doodads/azulian/white-wl1.png new file mode 100644 index 0000000..9f98a1f Binary files /dev/null and b/dev-assets/doodads/azulian/white-wl1.png differ diff --git a/dev-assets/doodads/azulian/white-wl2.png b/dev-assets/doodads/azulian/white-wl2.png new file mode 100644 index 0000000..ec900ce Binary files /dev/null and b/dev-assets/doodads/azulian/white-wl2.png differ diff --git a/dev-assets/doodads/azulian/white-wl3.png b/dev-assets/doodads/azulian/white-wl3.png new file mode 100644 index 0000000..a87537f Binary files /dev/null and b/dev-assets/doodads/azulian/white-wl3.png differ diff --git a/dev-assets/doodads/azulian/white-wl4.png b/dev-assets/doodads/azulian/white-wl4.png new file mode 100644 index 0000000..7401607 Binary files /dev/null and b/dev-assets/doodads/azulian/white-wl4.png differ diff --git a/dev-assets/doodads/azulian/white-wr1.png b/dev-assets/doodads/azulian/white-wr1.png new file mode 100644 index 0000000..d9c26d1 Binary files /dev/null and b/dev-assets/doodads/azulian/white-wr1.png differ diff --git a/dev-assets/doodads/azulian/white-wr2.png b/dev-assets/doodads/azulian/white-wr2.png new file mode 100644 index 0000000..1a1a566 Binary files /dev/null and b/dev-assets/doodads/azulian/white-wr2.png differ diff --git a/dev-assets/doodads/azulian/white-wr3.png b/dev-assets/doodads/azulian/white-wr3.png new file mode 100644 index 0000000..7eeb34d Binary files /dev/null and b/dev-assets/doodads/azulian/white-wr3.png differ diff --git a/dev-assets/doodads/azulian/white-wr4.png b/dev-assets/doodads/azulian/white-wr4.png new file mode 100644 index 0000000..ee29adb Binary files /dev/null and b/dev-assets/doodads/azulian/white-wr4.png differ diff --git a/dev-assets/doodads/bird/bird.js b/dev-assets/doodads/bird/bird.js index 277769f..8d24276 100644 --- a/dev-assets/doodads/bird/bird.js +++ b/dev-assets/doodads/bird/bird.js @@ -4,13 +4,13 @@ let speed = 4, Vx = Vy = 0, altitude = Self.Position().Y; // original height in the level - let direction = "left", - lastDirection = "left"; - let states = { - flying: 0, - diving: 1, - }; - let state = states.flying; +let direction = "left", + lastDirection = "left"; +let states = { + flying: 0, + diving: 1, +}; +let state = states.flying; function main() { Self.SetMobile(true); @@ -106,6 +106,8 @@ function main() { // A.I. subroutine: scan for the player character. // The bird scans in a 45 degree angle downwards, if the // player is seen nearby in that scan it will begin a dive. +// It's not hostile towards characters that can fly (having +// no gravity). function AI_ScanForPlayer() { let stepY = 12, // number of pixels to skip stepX = stepY, @@ -130,7 +132,7 @@ function AI_ScanForPlayer() { scanX += stepX; scanY += stepY; for (let actor of Actors.At(Point(scanX, scanY))) { - if (actor.IsPlayer()) { + if (actor.IsPlayer() && actor.HasGravity()) { state = states.diving; return; } diff --git a/pkg/balance/numbers.go b/pkg/balance/numbers.go index 0304726..87bf946 100644 --- a/pkg/balance/numbers.go +++ b/pkg/balance/numbers.go @@ -88,6 +88,10 @@ var ( PlayModeIdleTimeout = 2200 * time.Millisecond PlayModeAlphaStep = 8 // 0-255 alpha, steps per tick for fade in PlayModeAlphaMax = 220 + + // Invulnerability time in seconds at respawn from checkpoint, in case + // enemies are spawn camping. + RespawnGodModeTimer = 3 * time.Second ) // Edit Mode Values diff --git a/pkg/play_scene.go b/pkg/play_scene.go index afc1238..ecb7230 100644 --- a/pkg/play_scene.go +++ b/pkg/play_scene.go @@ -66,11 +66,12 @@ type PlayScene struct { Player *uix.Actor playerPhysics *physics.Mover lastCheckpoint render.Point - playerLastDirection float64 // player's heading last tick - antigravity bool // Cheat: disable player gravity - noclip bool // Cheat: disable player clipping - godMode bool // Cheat: player can't die - playerJumpCounter int // limit jump length + playerLastDirection float64 // player's heading last tick + antigravity bool // Cheat: disable player gravity + noclip bool // Cheat: disable player clipping + godMode bool // Cheat: player can't die + godModeUntil time.Time // Invulnerability timer at respawn. + playerJumpCounter int // limit jump length // Inventory HUD. Impl. in play_inventory.go invenFrame *ui.Frame @@ -404,6 +405,9 @@ func (s *PlayScene) SetCheckpoint(where render.Point) { // RetryCheckpoint moves the player back to their last checkpoint. func (s *PlayScene) RetryCheckpoint() { + // Grant the player invulnerability for 5 seconds + s.godModeUntil = time.Now().Add(balance.RespawnGodModeTimer) + log.Info("Move player back to last checkpoint") s.Player.MoveTo(s.lastCheckpoint) s.running = true @@ -421,11 +425,12 @@ func (s *PlayScene) BeatLevel() { // FailLevel handles a level failure triggered by a doodad. func (s *PlayScene) FailLevel(message string) { - if s.godMode { + if s.godMode || s.godModeUntil.After(time.Now()) { return } s.SetImperfect() s.d.FlashError(message) + s.ShowEndLevelModal( false, "You've died!",