Add chirping when pet

This commit is contained in:
Idrees Hassan
2026-01-04 17:34:34 -05:00
parent b8de14bb94
commit 5a82ba858f
10 changed files with 285 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import Frame from './frame.js';
import Layer from './layer.js';
import Anim from './anim.js';
import { Birb, Animations } from './birb.js';
import { Birdsong } from './sound.js';
import { Context, ObsidianContext } from './context.js';
import {
@@ -203,6 +204,8 @@ function startApplication(birbPixels, featherPixels) {
FLYING: "flying",
};
const birdsong = new Birdsong();
let frozen = false;
let stateStart = Date.now();
let currentState = States.IDLE;
@@ -897,6 +900,7 @@ function startApplication(birbPixels, featherPixels) {
function pet() {
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
birdsong.chirp();
birb.setAnimation(Animations.HEART);
lastPetTimestamp = Date.now();
}