User prompt
keep the dotted lines there just black
User prompt
make the dotted lines coming from the bees and the fly's black.
User prompt
don't have bees spawn from the hive
User prompt
make it where keep the bee hive the same height and with.
User prompt
make the lines from the bees and the fly's black. make the hive WAY less big and keep it the same biggest.
User prompt
get rid of the blue dot and the green thing at the bottom
User prompt
get rid of the green thing at the bottom and out the bee hive there.
User prompt
make the bee hive more realistic and at the bottom
User prompt
make a bee hive at the right bottom corner.
User prompt
get rid of the text at the top
User prompt
make the them fly not look like there floating.
User prompt
Please fix the bug: 'tween.create is not a function' in or related to this line: 'tween.create(insect.leftWing).to({' Line Number: 364 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make the bees and fly's smoothly fly
User prompt
keep the bees the same and make the fly's head less big.
User prompt
now give the bees and fly's heads and make them thinner.
User prompt
have the stripes on the bees go the other way and make all of the fly's and bees body a oval.
User prompt
perfect for the wings keep thows the same but make the body of the fly's and wings more like a oval.
User prompt
make the wings not black and rounder and a little see-through ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make the bees and flys have heads and wings
User prompt
make the fly's and bees bigger please.
Code edit (1 edits merged)
Please save this source code
User prompt
Buzz Trails: Aerial Chase
Initial prompt
Top view of a bunch of yellow and black bees flying Fastly and each 10 seconds doted lines leave a trail behind the bees and each 10 seconds they disappear. There are fly's on the screen too they fly the same speed and are black and brown.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Insect = Container.expand(function (type, speed) {
var self = Container.call(this);
self.type = type || 'bee';
self.speed = speed || 3;
self.vx = Math.random() * self.speed * (Math.random() > 0.5 ? 1 : -1);
self.vy = Math.random() * self.speed * (Math.random() > 0.5 ? 1 : -1);
self.lastTrailTime = 0;
self.trailActive = false;
self.trails = [];
self.flightOffset = Math.random() * Math.PI * 2; // Random flight pattern offset
self.flightSpeed = 0.5 + Math.random() * 0.5; // Random flight pattern speed
self.lastRotation = Math.atan2(self.vy, self.vx);
if (self.type === 'bee') {
// Main body
self.body = self.attachAsset('beeBody', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.4,
scaleY: 0.7
});
// Bee head
self.head = self.attachAsset('beeBody', {
anchorX: 0.5,
anchorY: 0.5,
x: 80,
scaleX: 0.6,
scaleY: 0.6
});
// Left wing
self.leftWing = self.attachAsset('beeBody', {
anchorX: 0.5,
anchorY: 0.5,
x: -25,
y: -30,
rotation: -0.7,
scaleX: 0.8,
alpha: 0.6,
tint: 0xffffff
});
// Right wing
self.rightWing = self.attachAsset('beeBody', {
anchorX: 0.5,
anchorY: 0.5,
x: -25,
y: 30,
rotation: 0.7,
scaleX: 0.8,
alpha: 0.6,
tint: 0xffffff
});
// Body stripes (reversed direction - vertical instead of horizontal)
self.stripe1 = self.attachAsset('beeStripe1', {
anchorX: 0.5,
anchorY: 0.5,
rotation: Math.PI / 2,
x: -25,
scaleX: 0.7,
scaleY: 0.8
});
self.stripe2 = self.attachAsset('beeStripe2', {
anchorX: 0.5,
anchorY: 0.5,
rotation: Math.PI / 2,
x: 25,
scaleX: 0.7,
scaleY: 0.8
});
} else {
// Main body
self.body = self.attachAsset('flyBody', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.6,
scaleY: 0.6
});
// Fly head
self.head = self.attachAsset('flyBody', {
anchorX: 0.5,
anchorY: 0.5,
x: 90,
scaleX: 0.5,
scaleY: 0.5
});
// Left wing
self.leftWing = self.attachAsset('flyBody', {
anchorX: 0.5,
anchorY: 0.5,
x: -15,
y: -25,
rotation: -0.6,
scaleX: 1.0,
scaleY: 0.6,
alpha: 0.6,
tint: 0xccccff
});
// Right wing
self.rightWing = self.attachAsset('flyBody', {
anchorX: 0.5,
anchorY: 0.5,
x: -15,
y: 25,
rotation: 0.6,
scaleX: 1.0,
scaleY: 0.6,
alpha: 0.6,
tint: 0xccccff
});
// Body stripe
self.stripe1 = self.attachAsset('flyStripe', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.8
});
}
self.update = function () {
// Create smooth flight pattern with sine wave movement
var time = LK.ticks * 0.01;
var sineOffset = Math.sin(time * 2) * 2; // Subtle sine wave movement
var cosOffset = Math.cos(time * 1.5) * 2; // Perpendicular sine wave
// Apply smooth movement with sine wave pattern
self.x += self.vx + sineOffset * Math.cos(self.rotation + Math.PI / 2);
self.y += self.vy + cosOffset * Math.sin(self.rotation + Math.PI / 2);
// Bounce off screen edges
if (self.x < 0 || self.x > 2048) {
self.vx *= -1;
self.x = Math.max(0, Math.min(2048, self.x));
}
if (self.y < 0 || self.y > 2732) {
self.vy *= -1;
self.y = Math.max(0, Math.min(2732, self.y));
}
// Smooth rotation transition
var targetRotation = Math.atan2(self.vy, self.vx);
// Interpolate current rotation towards target rotation
self.rotation = self.rotation + (targetRotation - self.rotation) * 0.1;
// Wings are now animated with tweens
// Just update wing alpha for pulsing effect
if (self.leftWing && self.rightWing) {
var wingAlpha = 0.6 + Math.sin(LK.ticks * 0.1) * 0.2;
self.leftWing.alpha = wingAlpha;
self.rightWing.alpha = wingAlpha;
}
// Create trails when active
if (self.trailActive && LK.ticks % 5 === 0) {
var dot = LK.getAsset('trailDot', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
});
dot.x = self.x;
dot.y = self.y;
if (self.type === 'bee') {
dot.tint = 0xf7df18;
} else {
dot.tint = 0x8B4513;
}
// Add dot to the game
game.addChild(dot);
// Store reference to dot
self.trails.push({
dot: dot,
createdAt: LK.ticks
});
}
// Remove old trail dots after 2 seconds
for (var i = self.trails.length - 1; i >= 0; i--) {
var trail = self.trails[i];
if (LK.ticks - trail.createdAt > 120) {
trail.dot.destroy();
self.trails.splice(i, 1);
}
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
self.body = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0;
self.maxSpeed = 6;
self.targetX = 0;
self.targetY = 0;
self.moving = false;
self.update = function () {
if (self.moving) {
// Calculate direction
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < self.speed) {
self.x = self.targetX;
self.y = self.targetY;
self.moving = false;
self.speed = 0;
} else {
// Normalize direction
dx = dx / distance;
dy = dy / distance;
// Accelerate gradually
if (self.speed < self.maxSpeed) {
self.speed += 0.2;
}
// Move player
self.x += dx * self.speed;
self.y += dy * self.speed;
}
} else {
// Decelerate gradually when not moving
if (self.speed > 0) {
self.speed *= 0.9;
}
}
// Keep player within bounds
self.x = Math.max(self.body.width / 2, Math.min(2048 - self.body.width / 2, self.x));
self.y = Math.max(self.body.height / 2, Math.min(2732 - self.body.height / 2, self.y));
// Check collision with insects
for (var i = 0; i < insects.length; i++) {
if (insects[i].visible && self.intersects(insects[i])) {
self.die();
break;
}
}
};
self.moveTo = function (x, y) {
self.targetX = x;
self.targetY = y;
self.moving = true;
};
self.die = function () {
LK.effects.flashObject(self, 0xFF0000, 500);
// Decrement lives
lives--;
updateLivesText();
if (lives <= 0) {
LK.effects.flashScreen(0xFF0000, 1000);
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
} else {
// Reset position
self.x = 2048 / 2;
self.y = 2732 - 200;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Game variables
var insects = [];
var player;
var lives = 3;
var lastTrailToggleTime = 0;
var trailsEnabled = false;
var timeElapsed = 0;
var timeDisplay;
var livesDisplay;
// Initialize scoreboard
var scoreTxt = new Text2('Time: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Initialize lives display
var livesText = new Text2('Lives: ' + lives, {
size: 80,
fill: 0xFFFFFF
});
livesText.anchor.set(0.5, 0);
livesText.y = 100;
LK.gui.top.addChild(livesText);
// Create player
player = new Player();
player.x = 2048 / 2;
player.y = 2732 - 200;
game.addChild(player);
// Create insects
for (var i = 0; i < 15; i++) {
createInsect();
}
// Set up wing flapping tweens for all insects
function setupWingTweens() {
for (var i = 0; i < insects.length; i++) {
var insect = insects[i];
var wingDuration = 500 + Math.random() * 300; // Random wing flap duration
// Left wing tween
tween.create(insect.leftWing).to({
rotation: -1.0
}, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
// Right wing tween with slight offset
tween.create(insect.rightWing).to({
rotation: 1.0
}, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
}
}
// Initialize wing tweens
setupWingTweens();
// Play background music
LK.playMusic('bgmusic');
// Game timer
var gameTimer = LK.setInterval(function () {
timeElapsed += 1;
scoreTxt.setText('Time: ' + timeElapsed);
// Toggle trails every 10 seconds
if (timeElapsed % 10 === 0 && timeElapsed > 0) {
toggleTrails();
}
// Increase difficulty over time
if (timeElapsed % 30 === 0 && timeElapsed > 0 && insects.length < 30) {
createInsect();
}
}, 1000);
// Function to create a new insect
function createInsect() {
var type = Math.random() > 0.5 ? 'bee' : 'fly';
var speed = 2 + Math.random() * 3; // Random speed between 2-5
var insect = new Insect(type, speed);
// Position randomly but not too close to the player
do {
insect.x = Math.random() * 2048;
insect.y = Math.random() * 2000; // Keep away from bottom
} while (getDistance(insect.x, insect.y, player.x, player.y) < 300);
game.addChild(insect);
insects.push(insect);
// Setup smooth wing tweens for this insect
var wingDuration = 500 + Math.random() * 300; // Random wing flap duration
// Left wing tween
tween.create(insect.leftWing).to({
rotation: -1.0
}, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
// Right wing tween with slight offset
tween.create(insect.rightWing).to({
rotation: 1.0
}, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
// Add subtle body movement
var bodyBobDuration = 1000 + Math.random() * 500;
tween.create(insect).to({
y: insect.y + 20
}, bodyBobDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
// Play buzz sound
LK.getSound('buzz').play();
}
// Function to toggle trails on all insects
function toggleTrails() {
trailsEnabled = !trailsEnabled;
for (var i = 0; i < insects.length; i++) {
insects[i].trailActive = trailsEnabled;
}
if (trailsEnabled) {
// Flash screen slightly to indicate trails activated
LK.effects.flashScreen(0xFFFFFF, 300, 0.3);
}
}
// Update lives text
function updateLivesText() {
livesText.setText('Lives: ' + lives);
}
// Helper function to calculate distance between two points
function getDistance(x1, y1, x2, y2) {
var dx = x2 - x1;
var dy = y2 - y1;
return Math.sqrt(dx * dx + dy * dy);
}
// Touch/mouse handlers
game.down = function (x, y, obj) {
player.moveTo(x, y);
};
// Main game update function
game.update = function () {
// Add slight random movement to insects occasionally
if (LK.ticks % 60 === 0) {
for (var i = 0; i < insects.length; i++) {
var insect = insects[i];
// Change velocity slightly
insect.vx += (Math.random() - 0.5) * 2;
insect.vy += (Math.random() - 0.5) * 2;
// Limit max speed
var speed = Math.sqrt(insect.vx * insect.vx + insect.vy * insect.vy);
if (speed > insect.speed) {
insect.vx = insect.vx / speed * insect.speed;
insect.vy = insect.vy / speed * insect.speed;
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -15,8 +15,11 @@
self.vy = Math.random() * self.speed * (Math.random() > 0.5 ? 1 : -1);
self.lastTrailTime = 0;
self.trailActive = false;
self.trails = [];
+ self.flightOffset = Math.random() * Math.PI * 2; // Random flight pattern offset
+ self.flightSpeed = 0.5 + Math.random() * 0.5; // Random flight pattern speed
+ self.lastRotation = Math.atan2(self.vy, self.vx);
if (self.type === 'bee') {
// Main body
self.body = self.attachAsset('beeBody', {
anchorX: 0.5,
@@ -119,11 +122,15 @@
scaleY: 0.8
});
}
self.update = function () {
- // Move the insect
- self.x += self.vx;
- self.y += self.vy;
+ // Create smooth flight pattern with sine wave movement
+ var time = LK.ticks * 0.01;
+ var sineOffset = Math.sin(time * 2) * 2; // Subtle sine wave movement
+ var cosOffset = Math.cos(time * 1.5) * 2; // Perpendicular sine wave
+ // Apply smooth movement with sine wave pattern
+ self.x += self.vx + sineOffset * Math.cos(self.rotation + Math.PI / 2);
+ self.y += self.vy + cosOffset * Math.sin(self.rotation + Math.PI / 2);
// Bounce off screen edges
if (self.x < 0 || self.x > 2048) {
self.vx *= -1;
self.x = Math.max(0, Math.min(2048, self.x));
@@ -131,23 +138,16 @@
if (self.y < 0 || self.y > 2732) {
self.vy *= -1;
self.y = Math.max(0, Math.min(2732, self.y));
}
- // Rotate based on movement direction
- self.rotation = Math.atan2(self.vy, self.vx);
- // Animate wings flapping
+ // Smooth rotation transition
+ var targetRotation = Math.atan2(self.vy, self.vx);
+ // Interpolate current rotation towards target rotation
+ self.rotation = self.rotation + (targetRotation - self.rotation) * 0.1;
+ // Wings are now animated with tweens
+ // Just update wing alpha for pulsing effect
if (self.leftWing && self.rightWing) {
- // Calculate wing offset based on time
- var wingOffset = Math.sin(LK.ticks * 0.3) * 0.2;
- // Update wing rotation
- self.leftWing.rotation = -0.7 + wingOffset;
- self.rightWing.rotation = 0.7 - wingOffset;
- // Slightly adjust wings scale for more dynamic movement
- var wingScale = 0.8 + Math.sin(LK.ticks * 0.2) * 0.1;
- var wingAlpha = 0.6 + Math.sin(LK.ticks * 0.15) * 0.1;
- // Apply scale and alpha changes
- self.leftWing.scale.set(wingScale, 1);
- self.rightWing.scale.set(wingScale, 1);
+ var wingAlpha = 0.6 + Math.sin(LK.ticks * 0.1) * 0.2;
self.leftWing.alpha = wingAlpha;
self.rightWing.alpha = wingAlpha;
}
// Create trails when active
@@ -300,8 +300,25 @@
// Create insects
for (var i = 0; i < 15; i++) {
createInsect();
}
+// Set up wing flapping tweens for all insects
+function setupWingTweens() {
+ for (var i = 0; i < insects.length; i++) {
+ var insect = insects[i];
+ var wingDuration = 500 + Math.random() * 300; // Random wing flap duration
+ // Left wing tween
+ tween.create(insect.leftWing).to({
+ rotation: -1.0
+ }, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
+ // Right wing tween with slight offset
+ tween.create(insect.rightWing).to({
+ rotation: 1.0
+ }, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
+ }
+}
+// Initialize wing tweens
+setupWingTweens();
// Play background music
LK.playMusic('bgmusic');
// Game timer
var gameTimer = LK.setInterval(function () {
@@ -327,8 +344,23 @@
insect.y = Math.random() * 2000; // Keep away from bottom
} while (getDistance(insect.x, insect.y, player.x, player.y) < 300);
game.addChild(insect);
insects.push(insect);
+ // Setup smooth wing tweens for this insect
+ var wingDuration = 500 + Math.random() * 300; // Random wing flap duration
+ // Left wing tween
+ tween.create(insect.leftWing).to({
+ rotation: -1.0
+ }, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
+ // Right wing tween with slight offset
+ tween.create(insect.rightWing).to({
+ rotation: 1.0
+ }, wingDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
+ // Add subtle body movement
+ var bodyBobDuration = 1000 + Math.random() * 500;
+ tween.create(insect).to({
+ y: insect.y + 20
+ }, bodyBobDuration).easing(tween.Easing.Sinusoidal.InOut).yoyo(true).repeat(Infinity).start();
// Play buzz sound
LK.getSound('buzz').play();
}
// Function to toggle trails on all insects