User prompt
twisted blood moon doesnt work also let the wendigo run throught when its twisted blood moon but he doesnt attack
User prompt
can you add another vampire varient(the stats dont really change but they both spawn in pairs of 2 when twisted bloodmoon)
User prompt
can you add a zombie and vampire in assets a twisted bloodmoon theme (the wendigo ISNT able to apear in twisted bloodmoons) also add a red and black shade for twisted bloodmoons a zombie chase theme and a wendigo chase theme
User prompt
can you make only the wood apear in the gui when its night and also make the cat being able to pick up wood also start with 3 wood and every 5-10 seconds deplete the wood if the fire runs out the night turns into a new type "twisted" bloodmoon where a new enemy type shows up vampires also add zombies that are able to apear in both nights(25% to apear 2 apear) and blood moon(50% to apear 3 apear) also there pretty slow vampires are fast and kill npcs the npcs run to the cabin when its "twisted" bloodmoon
User prompt
can you also make wood apear during night and a campfire and if it runs out you lose a live and when its night/peacefull night the npcs go the campfire instead of the cabin) and also make it so a blood moon cant apear after a blood moon ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
and also a live counter for the player its 3 lives for the dog 3 (the npc lives are hidden) for the deer its 2 lives and for the rest 1 (also make berries spawn less at night and they dont have 25% to spawn extra berries)
User prompt
the deer doesnt move in blood moon when targeted
User prompt
can you also make a day counter
User prompt
the animals are still green and stuff can you fix that to please
User prompt
theres a bug the music keeps playing like night keeps playing when its day can you please fix that
User prompt
can you delete the hit sound but if the npc gets hit they play the kill sound
User prompt
can you also add a touch sound for every animal in assets and kill/hit sounds
User prompt
also can you add when theres a bloodmoon instead of doing the berries x2 can you add the berries by 5 (what i mean is when the first bloodmoon happens it goes from 10>15 to advance the day AND bloodmoon also it goes from 5>10 to advance the night each bloodmoon it adds 5+ berries to collect so you can advance)
User prompt
can you also add a chase theme for the wolves when they get close and a 25% chance when night apears no wolves apears wich is called a "peacefull" night where nothing happens when the next night is a bloodmoon theres a 75% for a "peacefull" night also add ambience for a peacefull night please
User prompt
can you also add a blood moon music in assets
User prompt
can you also add a howl in assets that sounds when the night appears and also both a day song where theres birds and a night song where theres cricket
User prompt
they have a 50% chance to go to a berry and wait there so its harder for the player to get berries during the night
User prompt
the wolves also walk around at night
User prompt
also the wolfs only go after the player/npcs when there close
User prompt
okay i dont think you know the abillities cat,squirrel and bunny:they give a 2x multiplier but only the bunny is able to move when targeted the are drasticly slowed more slowed than the deer(there common so they have a 50% of apearing when an npc is chosen to spawn) deer:they dont give a multiplier but if they die they give 20 berries (is able to get multiplied) (uncommon so 35% chance of appearing when an npc is chosen to spawn) the deer also has an extra live so the deer is able to get hit twice they arent frozen when targeted but are slowed fennec they are also able to collect berries and dont get frozen but dont give a multiplier and if there targeted they CANT get into the cabin(uncommon so they have a 35% chance of apearing when a npc is chosen to spawn) mouse gives a 4x multiplier when targeted they get a speed boost and run to the cabin NO MATTER WHAT(rare so they have a 15% chance to spawn) dog can be killed when hit 3 times when its night/bloodmoon they stun a wolf for 5 seconds and get a slowed down a bit or stun the wendigo for 3 seconds getting targeted and getting slowed DRASTICLY after the stun they run back to the cabin to hide (rare 15% chance of apearing when an npc is chosen to spawn) also npcs have 25% to spawn after a night
User prompt
also the deer can move when targeted theyre only slowed also the wendigo targets like this (commons(25%)mouse(10%)fennec(20%)dog(50%)deer(30%)) also make the 3rd night be a blood moon and after the third night theres a 25% chance when its night its a blood moon
User prompt
also the dier doesnt give a multiplier niether does the fennec and the dog also they only the mouse gives a 4x multiplier and the rest give a 2x multiplier
User prompt
can you make it whenever a berry spawns it has a 25% chance to spawn another (maxes out at 4)
User prompt
make 3 wolves spawn at night but when theres a fennec fox it gets depleted by 1 when blood moon apears and the player survives it add 1 wolf when night apears
User prompt
can you make it only 20% for an npc to spawn and dont make the bunny show up in the start
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bunny = Container.expand(function () {
var self = Container.call(this);
var bunnyGraphics = self.attachAsset('bunny', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
self.berriesGiven = 0;
self.update = function () {
// Gentle bouncing animation
self.y += Math.sin(LK.ticks * 0.15) * 0.3;
// Move bunny around in a gentle pattern
if (LK.ticks % 120 === 0) {
// Every 2 seconds, move to a new position
var newX = Math.random() * (1800 - 200) + 200;
var newY = Math.random() * (2400 - 200) + 200;
tween(self, {
x: newX,
y: newY
}, {
duration: 2000,
easing: tween.easeInOut
});
}
};
return self;
});
var Fox = Container.expand(function () {
var self = Container.call(this);
var foxGraphics = self.attachAsset('fox', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var NPC = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
// Set multiplier based on type: only mouse gives 4x, cat/bunny/squirrel give 2x, deer/fennec/dog give no multiplier
if (type === 'mouse') {
self.multiplier = 4;
} else if (type === 'cat' || type === 'bunny' || type === 'squirrel') {
self.multiplier = 2;
} else {
self.multiplier = 0; // deer, fennec, dog don't give multipliers
}
self.inCabin = false;
self.frozen = false;
// Set hit points: deer has 2 lives, dog has 3 lives, others have 1
if (type === 'deer') {
self.hitPoints = 2;
} else if (type === 'dog') {
self.hitPoints = 3;
} else {
self.hitPoints = 1;
}
self.isTargeted = false;
self.rarity = 'common'; // Default rarity, will be set when spawned
var npcGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
// Add rarity visual indicator after graphics are created
self.setRarityVisual = function () {
if (self.rarity === 'uncommon') {
npcGraphics.tint = 0x00FF00; // Green tint for uncommon
} else if (self.rarity === 'rare') {
npcGraphics.tint = 0xFF00FF; // Purple tint for rare
}
// Common NPCs keep default white tint (0xFFFFFF)
};
self.update = function () {
if (self.frozen || self.inCabin) return;
// Apply movement speed based on targeting and type
if (self.isTargeted) {
if (self.type === 'bunny') {
// Bunny can move when targeted but is drastically slowed
self.targetedSpeed = 0.3;
} else if (self.type === 'cat' || self.type === 'squirrel') {
// Cat and squirrel are more drastically slowed than deer
self.targetedSpeed = 0.1;
} else if (self.type === 'deer') {
// Deer is slowed but not as much as commons
self.targetedSpeed = 0.5;
} else if (self.type === 'mouse') {
// Mouse gets speed boost when targeted
self.targetedSpeed = 4;
} else if (self.type === 'fennec') {
// Fennec can't enter cabin when targeted
self.canEnterCabin = false;
self.targetedSpeed = 1;
} else if (self.type === 'dog') {
// Dog is slowed drastically when targeted
self.targetedSpeed = 0.2;
}
}
// Fennec fox behavior - collect berries and deplete wolves
if (self.type === 'fennec' && (!self.isTargeted || !self.canEnterCabin)) {
// Check for nearby berries to collect
for (var b = normalBerries.length - 1; b >= 0; b--) {
var berry = normalBerries[b];
var berryDist = Math.sqrt(Math.pow(berry.x - self.x, 2) + Math.pow(berry.y - self.y, 2));
if (berryDist < 100) {
// Move towards berry
var dx = berry.x - self.x;
var dy = berry.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.x += dx / distance * 2;
self.y += dy / distance * 2;
}
// Collect berry if close enough
if (berryDist < 50) {
normalBerries.splice(b, 1);
berry.destroy();
berriesCollectedInCycle++;
break;
}
return;
}
}
// Deplete wolves during night
if (isNight && wolves.length > 0) {
var targetWolf = wolves[0];
var wolfDist = Math.sqrt(Math.pow(targetWolf.x - self.x, 2) + Math.pow(targetWolf.y - self.y, 2));
if (wolfDist < 100) {
// Remove one wolf
targetWolf.destroy();
wolves.splice(0, 1);
}
}
}
// Deer behavior - run from wendigo, give berries when killed
if (self.type === 'deer') {
if (isBloodMoon && wendigo) {
var wendigoDist = Math.sqrt(Math.pow(wendigo.x - self.x, 2) + Math.pow(wendigo.y - self.y, 2));
if (wendigoDist < 400) {
// Run away from wendigo - slower when targeted
var speed = self.isTargeted ? 1.5 : 3;
var dx = self.x - wendigo.x;
var dy = self.y - wendigo.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.x += dx / distance * speed;
self.y += dy / distance * speed;
}
return;
}
}
}
// Mouse behavior - run to cabin but slow down when targeted
if (self.type === 'mouse') {
if ((isNight || isBloodMoon) && !self.inCabin) {
var targetSpeed = self.isTargeted ? 1 : 3;
var dx = cabin.x - self.x;
var dy = cabin.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 50) {
self.x += dx / distance * targetSpeed;
self.y += dy / distance * targetSpeed;
} else {
self.enterCabin();
}
return;
}
}
// Dog behavior during night/blood moon
if (self.type === 'dog' && (isNight || isBloodMoon) && !self.isTargeted) {
// Check for nearby wolves or wendigo
var nearestThreat = null;
var minDistance = Infinity;
// Check wolves
for (var w = 0; w < wolves.length; w++) {
if (!wolves[w].stunned) {
var dist = Math.sqrt(Math.pow(wolves[w].x - self.x, 2) + Math.pow(wolves[w].y - self.y, 2));
if (dist < minDistance) {
minDistance = dist;
nearestThreat = wolves[w];
}
}
}
// Check wendigo
if (wendigo && !wendigo.stunned) {
var wendigoDist = Math.sqrt(Math.pow(wendigo.x - self.x, 2) + Math.pow(wendigo.y - self.y, 2));
if (wendigoDist < minDistance) {
minDistance = wendigoDist;
nearestThreat = wendigo;
}
}
// If threat is close enough (within 300 pixels), attack it
if (nearestThreat && minDistance < 300) {
self.isTargeted = true;
// Move towards threat to stun it
var dx = nearestThreat.x - self.x;
var dy = nearestThreat.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.x += dx / distance * 4; // Dog moves fast when attacking
self.y += dy / distance * 4;
}
return;
}
}
// Normal movement when not attacking
if (!self.isTargeted) {
// Gentle movement animation
self.y += Math.sin(LK.ticks * 0.1 + self.x * 0.01) * 0.3;
if (LK.ticks % 200 === 0) {
var newX = Math.random() * (1800 - 200) + 200;
var newY = Math.random() * (2400 - 200) + 200;
tween(self, {
x: newX,
y: newY
}, {
duration: 3000,
easing: tween.easeInOut
});
}
}
};
self.enterCabin = function () {
self.inCabin = true;
tween(self, {
x: cabin.x,
y: cabin.y,
alpha: 0.3
}, {
duration: 1000
});
};
self.exitCabin = function () {
self.inCabin = false;
var newX = Math.random() * (1800 - 200) + 200;
var newY = Math.random() * (2400 - 200) + 200;
tween(self, {
x: newX,
y: newY,
alpha: 1
}, {
duration: 1000
});
};
self.freeze = function () {
self.frozen = true;
npcGraphics.tint = 0x4444ff;
};
self.takeDamage = function () {
self.hitPoints--;
if (self.hitPoints <= 0) {
// If it's a deer being killed, spawn 20 berries (can be multiplied)
if (self.type === 'deer') {
for (var i = 0; i < 20; i++) {
LK.setTimeout(function () {
spawnNormalBerry();
}, i * 100); // Stagger berry spawning
}
}
return true; // NPC is killed
} else {
// Flash red to show damage
tween(npcGraphics, {
tint: 0xFF0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(npcGraphics, {
tint: 0xFFFFFF
}, {
duration: 200
});
}
});
return false;
}
};
self.stunThreat = function (threat) {
if (threat === wendigo) {
threat.stunned = true;
threat.stunnedUntil = LK.ticks + 180; // 3 seconds at 60fps
} else {
threat.stunned = true;
threat.stunnedUntil = LK.ticks + 300; // 5 seconds at 60fps
}
// Make threat flash blue to show it's stunned
tween(threat.children[0], {
tint: 0x4444FF
}, {
duration: 300
});
// Dog retreats after stunning
self.isTargeted = true;
var retreatX = Math.random() * (1800 - 200) + 200;
var retreatY = Math.random() * (2400 - 200) + 200;
tween(self, {
x: retreatX,
y: retreatY
}, {
duration: 1000,
onFinish: function onFinish() {
self.isTargeted = false;
}
});
};
return self;
});
var NormalBerry = Container.expand(function () {
var self = Container.call(this);
var berryGraphics = self.attachAsset('normalBerry', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Gentle floating animation
self.y += Math.sin(LK.ticks * 0.1 + self.x * 0.01) * 0.5;
};
return self;
});
var Wendigo = Container.expand(function () {
var self = Container.call(this);
// Create a scary looking wendigo using a dark red box shape
var wendigoGraphics = self.attachAsset('wendigoBody', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.lastFoxX = 0;
self.lastFoxY = 0;
self.update = function () {
if (!isBloodMoon) return;
if (self.stunned && LK.ticks < self.stunnedUntil) {
// Wendigo is stunned, can't move
return;
} else if (self.stunned) {
// Stun expired, remove stun
self.stunned = false;
tween(wendigoGraphics, {
tint: 0xFFFFFF
}, {
duration: 300
});
}
// Check for dog collision for stunning
for (var d = 0; d < npcs.length; d++) {
if (npcs[d].type === 'dog' && npcs[d].isTargeted && self.intersects(npcs[d])) {
npcs[d].stunThreat(self);
break;
}
}
// Calculate survival time and increase speed accordingly
var survivalTime = (LK.ticks - bloodMoonStartTime) / 60; // Convert to seconds
var currentSpeed = self.speed + survivalTime * wendigoSpeedIncreaseRate;
// Wendigo targeting with probability system
var target = null;
var availableTargets = [];
// Check for frozen NPC first (always highest priority)
for (var i = 0; i < npcs.length; i++) {
if (npcs[i].frozen && !npcs[i].killed) {
target = npcs[i];
break;
}
}
// If no frozen NPC, use probability system
if (!target) {
// Create weighted target list based on probabilities
for (var i = 0; i < npcs.length; i++) {
var npc = npcs[i];
if (!npc.inCabin && !npc.killed) {
var weight = 0;
if (npc.type === 'cat' || npc.type === 'bunny' || npc.type === 'squirrel') {
weight = 25; // Common NPCs 25%
} else if (npc.type === 'mouse') {
weight = 10; // Mouse 10%
} else if (npc.type === 'fennec') {
weight = 20; // Fennec 20%
} else if (npc.type === 'dog') {
weight = 50; // Dog 50%
} else if (npc.type === 'deer') {
weight = 30; // Deer 30%
}
// Add multiple entries based on weight for probability
for (var w = 0; w < weight; w++) {
availableTargets.push(npc);
}
}
}
// Select random target from weighted list
if (availableTargets.length > 0) {
target = availableTargets[Math.floor(Math.random() * availableTargets.length)];
target.isTargeted = true; // Mark target as targeted
}
}
if (!target) {
target = fox;
}
if (!target) return;
// Move towards target
var dx = target.x - self.x;
var dy = target.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
// Normalize direction and apply increasing speed
self.x += dx / distance * currentSpeed;
self.y += dy / distance * currentSpeed;
}
// Check if wendigo caught frozen NPC
for (var i = 0; i < npcs.length; i++) {
var npc = npcs[i];
if (npc.frozen && !npc.killed && self.intersects(npc)) {
// Attack the NPC (dogs take 2 hits, others die in 1)
var isKilled = npc.takeDamage();
if (isKilled) {
npc.killed = true;
// Make NPC disappear with death effect
tween(npc, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 500,
onFinish: function onFinish() {
npc.destroy();
npcs.splice(npcs.indexOf(npc), 1);
}
});
}
// Play kill sound
LK.getSound('wendigoGrowl').play();
break;
}
}
// Check if wendigo caught the fox
if (self.intersects(fox)) {
// Fox is caught - create jumpscare effect
LK.effects.flashScreen(0xffffff, 500);
// Scale wendigo up for jumpscare
tween(wendigo, {
scaleX: 3,
scaleY: 3
}, {
duration: 200
});
// Play jumpscare sound
LK.getSound('wendigoGrowl').play();
// Show scary game over after jumpscare
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
return;
}
// Add scary breathing/pulsing effect
wendigoGraphics.scaleX = 1 + Math.sin(LK.ticks * 0.2) * 0.1;
wendigoGraphics.scaleY = 1 + Math.cos(LK.ticks * 0.2) * 0.1;
};
return self;
});
var Wolf = Container.expand(function () {
var self = Container.call(this);
var wolfGraphics = self.attachAsset('wolf', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.update = function () {
if (!isNight) return;
if (self.stunned && LK.ticks < self.stunnedUntil) {
// Wolf is stunned, can't move
return;
} else if (self.stunned) {
// Stun expired, remove stun
self.stunned = false;
tween(wolfGraphics, {
tint: 0xFFFFFF
}, {
duration: 300
});
}
// Check for dog collision for stunning
for (var d = 0; d < npcs.length; d++) {
if (npcs[d].type === 'dog' && npcs[d].isTargeted && self.intersects(npcs[d])) {
npcs[d].stunThreat(self);
break;
}
}
// Find closest target (fox or NPCs)
var closestTarget = null;
var closestDistance = Infinity;
var detectionRange = 400; // Wolves only chase when within 400 pixels
// Check distance to fox
var foxDx = fox.x - self.x;
var foxDy = fox.y - self.y;
var foxDistance = Math.sqrt(foxDx * foxDx + foxDy * foxDy);
if (foxDistance < detectionRange && foxDistance < closestDistance) {
closestTarget = fox;
closestDistance = foxDistance;
}
// Check distance to NPCs that are not in cabin
for (var n = 0; n < npcs.length; n++) {
if (!npcs[n].inCabin && !npcs[n].killed) {
var npcDx = npcs[n].x - self.x;
var npcDy = npcs[n].y - self.y;
var npcDistance = Math.sqrt(npcDx * npcDx + npcDy * npcDy);
if (npcDistance < detectionRange && npcDistance < closestDistance) {
closestTarget = npcs[n];
closestDistance = npcDistance;
}
}
}
// Only chase if there's a target within range
if (closestTarget && closestDistance < detectionRange) {
var dx = closestTarget.x - self.x;
var dy = closestTarget.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
} else {
// Add prowling animation when not chasing
wolfGraphics.scaleX = 1 + Math.sin(LK.ticks * 0.1) * 0.1;
// 50% chance to target a berry and wait there
if (!self.berryTarget && !self.wanderTarget && Math.random() < 0.01) {
if (Math.random() < 0.5 && normalBerries.length > 0) {
// 50% chance to target a berry
self.berryTarget = normalBerries[Math.floor(Math.random() * normalBerries.length)];
} else {
// Otherwise wander normally
self.wanderTarget = {
x: Math.random() * (1800 - 200) + 200,
y: Math.random() * (2400 - 200) + 200
};
}
}
// Move towards berry target and wait there
if (self.berryTarget) {
// Check if berry still exists
var berryExists = false;
for (var b = 0; b < normalBerries.length; b++) {
if (normalBerries[b] === self.berryTarget) {
berryExists = true;
break;
}
}
if (!berryExists) {
// Berry was collected, pick a new target
self.berryTarget = null;
} else {
var berryDx = self.berryTarget.x - self.x;
var berryDy = self.berryTarget.y - self.y;
var berryDistance = Math.sqrt(berryDx * berryDx + berryDy * berryDy);
if (berryDistance > 100) {
// Move towards berry
var berrySpeed = self.speed * 0.4;
self.x += berryDx / berryDistance * berrySpeed;
self.y += berryDy / berryDistance * berrySpeed;
}
// If close enough to berry (within 100 pixels), just wait there
}
}
// Wandering behavior when not targeting berry or chasing
if (!self.berryTarget && self.wanderTarget) {
var wanderDx = self.wanderTarget.x - self.x;
var wanderDy = self.wanderTarget.y - self.y;
var wanderDistance = Math.sqrt(wanderDx * wanderDx + wanderDy * wanderDy);
if (wanderDistance > 50) {
// Only move if not close to target
var wanderSpeed = self.speed * 0.3; // Slower wandering speed
self.x += wanderDx / wanderDistance * wanderSpeed;
self.y += wanderDy / wanderDistance * wanderSpeed;
} else {
// Reached wander target, pick a new one
self.wanderTarget = null;
}
}
}
// Check if wolf caught the fox for jumpscare
if (self.intersects(fox)) {
// Wolf jumpscare effect
LK.effects.flashScreen(0xffffff, 300);
// Scale wolf up for jumpscare
tween(self, {
scaleX: 2.5,
scaleY: 2.5
}, {
duration: 150
});
// Play wolf roar sound
LK.getSound('wolfRoar').play();
// Show game over after jumpscare
LK.setTimeout(function () {
LK.showGameOver();
}, 800);
return;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x228b22
});
/****
* Game Code
****/
// Game state variables
var fox;
var normalBerries = [];
var wolves = [];
var npcs = [];
var dragNode = null;
var berrySpawnTimer = 0;
var wendigo;
var wendigoSpeedIncreaseRate = 0.02;
var bunny;
var cabin;
// Day/Night cycle variables
var isNight = false;
var isBloodMoon = false;
var nightCount = 0;
var berriesCollectedInCycle = 0;
var scoreMultiplier = 1;
var bloodMoonStartTime = 0;
var bloodMoonCount = 0;
var dayLengthMultiplier = 1;
// NPC types organized by rarity
var commonNPCs = ['cat', 'bunny', 'squirrel'];
var uncommonNPCs = ['deer', 'fennec'];
var rareNPCs = ['dog', 'mouse'];
// Add forest background
var background = game.attachAsset('forestBackground', {
x: 0,
y: 0
});
// Create score display
var scoreTxt = new Text2('Score: 0 (x1)', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create day/night indicator
var dayNightTxt = new Text2('Day', {
size: 60,
fill: 0xFFFF00
});
dayNightTxt.anchor.set(0.5, 0);
dayNightTxt.y = 100;
LK.gui.top.addChild(dayNightTxt);
// Add cabin for NPCs
cabin = game.attachAsset('cabin', {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 450
});
// Bunny removed from initial spawn
// Initialize fox
fox = game.addChild(new Fox());
fox.x = 1024;
fox.y = 1366;
// Spawn normal berry function
function spawnNormalBerry() {
var berriesSpawned = 1;
var maxBerries = 4;
// Spawn first berry
var berry = new NormalBerry();
berry.x = Math.random() * (2048 - 120) + 60;
berry.y = Math.random() * (2732 - 120) + 60;
normalBerries.push(berry);
game.addChild(berry);
// Check for additional berries (25% chance each, max 4 total)
while (berriesSpawned < maxBerries && Math.random() < 0.25) {
var extraBerry = new NormalBerry();
extraBerry.x = Math.random() * (2048 - 120) + 60;
extraBerry.y = Math.random() * (2732 - 120) + 60;
normalBerries.push(extraBerry);
game.addChild(extraBerry);
berriesSpawned++;
}
}
// Spawn wolf function
function spawnWolf() {
var wolf = new Wolf();
wolf.x = Math.random() * (2048 - 120) + 60;
wolf.y = Math.random() * (2732 - 120) + 60;
wolves.push(wolf);
game.addChild(wolf);
}
// Spawn NPC function
function spawnNPC() {
// Determine rarity first with updated probabilities
var rarity;
var selectedType;
var rarityRand = Math.random();
if (rarityRand <= 0.5) {
// Common NPCs: 50% chance
rarity = 'common';
selectedType = commonNPCs[Math.floor(Math.random() * commonNPCs.length)];
} else if (rarityRand <= 0.85) {
// Uncommon NPCs: 35% chance
rarity = 'uncommon';
selectedType = uncommonNPCs[Math.floor(Math.random() * uncommonNPCs.length)];
} else {
// Rare NPCs: 15% chance
rarity = 'rare';
selectedType = rareNPCs[Math.floor(Math.random() * rareNPCs.length)];
}
var npc = new NPC(selectedType);
npc.rarity = rarity;
npc.setRarityVisual(); // Apply visual indication based on rarity
npc.x = Math.random() * (1800 - 200) + 200;
npc.y = Math.random() * (2400 - 200) + 200;
npcs.push(npc);
game.addChild(npc);
}
// Transition to night
function startNight() {
isNight = true;
nightCount++;
berriesCollectedInCycle = 0;
// Play howl sound when night appears
LK.getSound('howl').play();
// Switch to night music with crickets
LK.playMusic('nightMusic');
// Check for blood moon - 3rd night is guaranteed, then 25% chance
var shouldBeBloodMoon = false;
if (nightCount === 3) {
// 3rd night is always a blood moon
shouldBeBloodMoon = true;
} else if (nightCount > 3) {
// After 3rd night, 25% chance for blood moon
shouldBeBloodMoon = Math.random() < 0.25;
}
if (shouldBeBloodMoon) {
bloodMoonCount++;
// Double the day length multiplier after each blood moon
dayLengthMultiplier *= 2;
isBloodMoon = true;
bloodMoonStartTime = LK.ticks;
// Reset multiplier during blood moon
scoreMultiplier = 1;
updateScoreDisplay();
// Freeze one random NPC
if (npcs.length > 0) {
var randomNPC = npcs[Math.floor(Math.random() * npcs.length)];
randomNPC.freeze();
}
// Move other NPCs to cabin
for (var i = 0; i < npcs.length; i++) {
if (!npcs[i].frozen) {
npcs[i].enterCabin();
}
}
// Spawn wendigo
wendigo = new Wendigo();
wendigo.x = -100;
wendigo.y = Math.random() * 2000 + 300;
game.addChild(wendigo);
// Change background to blood red
game.setBackgroundColor(0x330000);
tween(background, {
tint: 0x660000,
alpha: 0.8
}, {
duration: 1500
});
dayNightTxt.setText('Blood Moon');
dayNightTxt.fill = 0xFF0000;
} else {
// Regular night
// Spawn wolves - 3 by default, reduced by 1 if fennec fox present
var baseWolves = 3 + bloodMoonCount; // Add 1 wolf for each survived blood moon
var fennecPresent = false;
for (var f = 0; f < npcs.length; f++) {
if (npcs[f].type === 'fennec') {
fennecPresent = true;
break;
}
}
var wolvesToSpawn = fennecPresent ? baseWolves - 1 : baseWolves;
for (var w = 0; w < wolvesToSpawn; w++) {
spawnWolf();
}
// Move NPCs to cabin
for (var i = 0; i < npcs.length; i++) {
npcs[i].enterCabin();
}
// Change background to dark blue night
game.setBackgroundColor(0x001122);
tween(background, {
tint: 0x223355,
alpha: 0.7
}, {
duration: 1500
});
dayNightTxt.setText('Night');
dayNightTxt.fill = 0x6666FF;
}
}
// Transition to day
function startDay() {
isNight = false;
isBloodMoon = false;
berriesCollectedInCycle = 0;
// Switch to day music with birds
LK.playMusic('dayMusic');
// Remove wolves
for (var i = 0; i < wolves.length; i++) {
wolves[i].destroy();
}
wolves = [];
// Remove wendigo if exists
if (wendigo) {
wendigo.destroy();
wendigo = null;
}
// Bring NPCs out of cabin
for (var i = 0; i < npcs.length; i++) {
if (!npcs[i].killed) {
npcs[i].exitCabin();
}
}
// Spawn new NPC with 25% chance
if (Math.random() < 0.25) {
spawnNPC();
}
// Change background back to day
game.setBackgroundColor(0x228b22);
tween(background, {
tint: 0xFFFFFF,
alpha: 1
}, {
duration: 1500
});
dayNightTxt.setText('Day');
dayNightTxt.fill = 0xFFFF00;
}
// Update score display with multiplier
function updateScoreDisplay() {
scoreTxt.setText('Score: ' + LK.getScore() + ' (x' + scoreMultiplier + ')');
}
// Keyboard state tracking
var keys = {
left: false,
right: false,
up: false,
down: false
};
// Handle mouse/touch move
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = x;
dragNode.y = y;
// Keep fox within bounds
if (dragNode.x < 60) dragNode.x = 60;
if (dragNode.x > 1988) dragNode.x = 1988;
if (dragNode.y < 60) dragNode.y = 60;
if (dragNode.y > 2672) dragNode.y = 2672;
}
}
// Mouse/touch events
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = fox;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
// Start with day music
LK.playMusic('dayMusic');
// Initial berry spawning
spawnNormalBerry();
spawnNormalBerry();
spawnNormalBerry();
// Main game update loop
game.update = function () {
// Spawn berries over time with random intervals between 1.5-5 seconds
berrySpawnTimer++;
var randomSpawnTime = Math.random() * (300 - 90) + 90; // 90-300 ticks (1.5-5 seconds)
if (berrySpawnTimer >= randomSpawnTime) {
spawnNormalBerry();
berrySpawnTimer = 0;
}
// Check collisions with normal berries
for (var i = normalBerries.length - 1; i >= 0; i--) {
var berry = normalBerries[i];
if (fox.intersects(berry)) {
// Collect berry and increase score with multiplier
var scoreGain = 1 * scoreMultiplier;
LK.setScore(LK.getScore() + scoreGain);
berriesCollectedInCycle++;
updateScoreDisplay();
LK.getSound('berryCollect').play();
// Remove berry from array first, then destroy
normalBerries.splice(i, 1);
berry.destroy();
// Check for day/night transitions
var dayRequirement = 10 * dayLengthMultiplier;
var nightRequirement = isBloodMoon ? dayRequirement : 5;
if (!isNight && berriesCollectedInCycle >= dayRequirement) {
startNight();
} else if (isNight && berriesCollectedInCycle >= nightRequirement) {
startDay();
}
}
}
// Check collisions with NPCs for score multiplier
for (var i = 0; i < npcs.length; i++) {
var npc = npcs[i];
if (!npc.inCabin && !npc.frozen && fox.intersects(npc)) {
// Only mouse gives 4x multiplier, cat/bunny/squirrel give 2x, others give no multiplier
if (npc.type === 'mouse') {
// Mouse gives 4x multiplier
scoreMultiplier = 4;
updateScoreDisplay();
} else if (npc.type === 'cat' || npc.type === 'bunny' || npc.type === 'squirrel') {
// Common NPCs (cat, bunny, squirrel) give 2x multiplier
scoreMultiplier = 2;
updateScoreDisplay();
}
// deer, fennec, dog don't give any multiplier
// Give visual feedback
tween(npc, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 200,
onFinish: function onFinish() {
tween(npc, {
scaleX: 1,
scaleY: 1
}, {
duration: 200
});
}
});
}
}
// Wolf collision is now handled in Wolf class update method
}; ===================================================================
--- original.js
+++ change.js
@@ -730,8 +730,12 @@
function startNight() {
isNight = true;
nightCount++;
berriesCollectedInCycle = 0;
+ // Play howl sound when night appears
+ LK.getSound('howl').play();
+ // Switch to night music with crickets
+ LK.playMusic('nightMusic');
// Check for blood moon - 3rd night is guaranteed, then 25% chance
var shouldBeBloodMoon = false;
if (nightCount === 3) {
// 3rd night is always a blood moon
@@ -810,8 +814,10 @@
function startDay() {
isNight = false;
isBloodMoon = false;
berriesCollectedInCycle = 0;
+ // Switch to day music with birds
+ LK.playMusic('dayMusic');
// Remove wolves
for (var i = 0; i < wolves.length; i++) {
wolves[i].destroy();
}
@@ -873,8 +879,10 @@
};
game.up = function (x, y, obj) {
dragNode = null;
};
+// Start with day music
+LK.playMusic('dayMusic');
// Initial berry spawning
spawnNormalBerry();
spawnNormalBerry();
spawnNormalBerry();
a cute fox with a basket. In-Game asset. 2d. High contrast. No shadows
a berry bush with a phew yummy berries on it. In-Game asset. 2d. High contrast. No shadows
a top view of a grass field with a cabin and some trees. In-Game asset. 2d. High contrast. No shadows
a cute little bunny. In-Game asset. 2d. High contrast. No shadows
cabin. In-Game asset. 2d. High contrast. No shadows
a angry wolve thats in 2d. In-Game asset. 2d. High contrast. No shadows
a cute cat with a bow. In-Game asset. 2d. High contrast. No shadows
a cute dear with an axe. In-Game asset. 2d. High contrast. No shadows
a dog cute dog with a hat and a shotgun. In-Game asset. 2d. High contrast. No shadows
a cute mouse with a hoodie on. In-Game asset. 2d. High contrast. No shadows
a cute fennec fox with a backbag. In-Game asset. 2d. High contrast. No shadows
a cute squirrel with a gutair. In-Game asset. 2d. High contrast. No shadows
a campfire. In-Game asset. 2d. High contrast. No shadows
sticks. In-Game asset. 2d. High contrast. No shadows
zombie duck. In-Game asset. 2d. High contrast. No shadows
cultists animal. In-Game asset. 2d. High contrast. No shadows
cultist girrafe. In-Game asset. 2d. High contrast. No shadows
cute nice bat cultist. In-Game asset. 2d. High contrast. No shadows
glitchSound
Sound effect
berryCollect
Sound effect
wendigoGrowl
Sound effect
wolfRoar
Sound effect
howl
Sound effect
dayMusic
Music
nightMusic
Music
bloodMoonMusic
Music
chaseTheme
Music
bunnyTouch
Sound effect
bunnyKill
Sound effect
catTouch
Sound effect
catKill
Sound effect
deerTouch
Sound effect
deerKill
Sound effect
dogTouch
Sound effect
dogKill
Sound effect
fennecTouch
Sound effect
fennecKill
Sound effect
mouseTouch
Sound effect
mouseKill
Sound effect
squirrelTouch
Sound effect
squirrelKill
Sound effect
peacefulNightAmbience
Music
twistedBloodMoonTheme
Music
wendigoChaseTheme
Music
zombieChaseTheme
Music
woodCollect
Sound effect
vampireJumpscare
Sound effect
dogStun
Sound effect
catWoodCollect
Sound effect
foxTwistedWoodCollect
Sound effect
batTouch
Sound effect
batKill
Sound effect