User prompt
gitara geçerken finger gitarın üzerinde spawn olsun ekrana gitarla birlikte kaysın
User prompt
durumdan gitara geçerken de finger gitarın üzerinde yapışık olsun ekrana gitarla birlikte kaysın
User prompt
fingerin animasyonu biraz daha yukarıya doğru olsun, ve gitardan ok işaretiyle başka bir yere geçsek bile görünsün konumu gitarın üzerine yapışık olsun, gitara döndüğümüz zaman gitarla birlikte kaysın.
User prompt
fingeri birazcık aşağıya kaydıralım, ve ok işaretine bastığımızda kaybolmasın konumu gitar ile birlikte sağa doğru gidip geri gelebilsin.
User prompt
finger gitara 10 com hızında tıklasın
User prompt
şimdi druma doğru oka bastığımızda finger konumunu korusun ve animasyona devam etsin
User prompt
animasyonu soldan sağa şeklinde değil de yukarı aşağıya şeklinde ayarlayalım, ve sola kaydıralım ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
fingeri çok hafif daha sola kaydıralım ve 90 derece saat yönünün tersine döndürelim
User prompt
fingeri baya sola kaydıralım
User prompt
finger asseti ekleyelim
User prompt
autofinger gitara 15 com hızında tıklasın
User prompt
finger gitara 30 cpm hızında tıklasın
User prompt
Finger ilk satın alma fiyatı 300 dolar olsun ve bize saniyede 4 gold kazandırsın
User prompt
gitara tıkladığımızda çıkan efekti çok az daha küçült
User prompt
gitara tıkladığımızda çıkan efekti küçült
User prompt
make fourtimes clap little bit slower with rapid clap-clap pattern, make double clap little bit faster with rapid clap-clap pattern
User prompt
clap fourtimes vuracağı zaman çok hızlı clapclap yapsın
User prompt
Save etme olayını kaldıralım, reload olduğunda tüm veriler resetlensin
User prompt
audience animasyonu kayboldu
User prompt
Update audience clapping pattern to: single-single-single-double-single-single-single-fourtimes (repeat)
User prompt
Audience satın alınmadan clap çalışmasın
User prompt
Single-single-double olsun, Tüm audience aynı senkronizasyonda çalsın.
User prompt
audience tekclap, tekclap, daha sonra çift clap yapmalı. Yani şöyle drum-clap-drum-clap-drum-clapclap-drum-clap-drum-clap-drum-clapclap diye gitmeli
User prompt
Finger buttonu artık Drumstick ile aynı değil
User prompt
Guitar satın alındığı anda butonların hepsi değişecek, Drumstick yerine Finger gelecek
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ArrowButton = Container.expand(function () { var self = Container.call(this); self.arrowShape = null; self.assetType = 'arrow'; // Default asset type self.init = function (assetType) { if (assetType) { self.assetType = assetType; } self.arrowShape = self.attachAsset(self.assetType, { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); }; self.clickHandler = null; self.down = function () { if (self.clickHandler) { self.clickHandler(); } if (self.arrowShape) { tween(self.arrowShape, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, onFinish: function onFinish() { tween(self.arrowShape, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); } }; return self; }); var Audience = Container.expand(function () { var self = Container.call(this); // Select audience asset sequentially var audienceAssets = ['audience1', 'audience2', 'audience3', 'audience4', 'audience5', 'audience6', 'audience7', 'audience8']; var selectedAsset = audienceAssets[audienceCounter % audienceAssets.length]; audienceCounter++; // Increment counter for next audience var audienceGraphics = self.attachAsset(selectedAsset, { anchorX: 0.5, anchorY: 0.5 }); self.instrument = null; self.multiplier = 1.2; self.update = function () { // The current implementation already provides the requested pattern if (LK.ticks % 120 === 0) { globalClapCounter++; // Every 3rd clap is a double clap if (globalClapCounter % 3 === 0) { // Play double clap LK.getSound('clap').play(); LK.setTimeout(function () { LK.getSound('clap').play(); }, 150); // Small delay for "çıt çıt" effect // Bigger animation for double clap tween(audienceGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(audienceGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); } else { // Single clap LK.getSound('clap').play(); // Small animation when clapping tween(audienceGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, onFinish: function onFinish() { tween(audienceGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); } } }; self.setInstrument = function (type) { if (self.instrument) { self.instrument.destroy(); } self.instrument = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5, x: 30, y: 0 }); }; return self; }); var AutoDrumstick = Container.expand(function () { var self = Container.call(this); var stickGraphics = self.attachAsset('drumstick', { anchorX: 0.5, anchorY: 0.9 }); self.speed = 1; self.income = 1000; self.animating = false; self.tickCounter = 0; self.drumReference = null; self.update = function () { self.tickCounter++; // Hit every 60 ticks (60 BPM = 1 hit per second at 60 FPS) if (self.tickCounter >= 60 && !self.animating) { self.tickCounter = 0; self.animate(); } }; self.animate = function () { if (self.animating) return; self.animating = true; tween(stickGraphics, { rotation: 0.3 }, { duration: 300, onFinish: function onFinish() { // Generate gold when hitting var startGold = gold; gold += self.income; // Smooth gold animation tween({ value: displayedGold }, { value: gold }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { displayedGold = gold; } }); var tweenObj = { value: displayedGold }; tween(tweenObj, { value: gold }, { duration: 300, easing: tween.easeOut }); Object.defineProperty(tweenObj, 'value', { get: function get() { return displayedGold; }, set: function set(v) { displayedGold = v; } }); // Play drum sound LK.getSound('drumhit').play(); // Visual feedback on drum if reference exists if (self.drumReference) { var drumGraphics = self.drumReference.children[0]; tween(drumGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 50, onFinish: function onFinish() { tween(drumGraphics, { scaleX: 1, scaleY: 1 }, { duration: 50 }); } }); } tween(stickGraphics, { rotation: 0 }, { duration: 200, onFinish: function onFinish() { self.animating = false; } }); } }); }; return self; }); var BuyButton = Container.expand(function () { var self = Container.call(this); var buttonBg = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 }); self.titleText = new Text2('', { size: 40, fill: '#ffffff' }); self.titleText.anchor.set(0.5, 0.5); self.titleText.y = -15; self.addChild(self.titleText); self.costText = new Text2('', { size: 30, fill: '#ffffff' }); self.costText.anchor.set(0.5, 0.5); self.costText.y = 15; self.addChild(self.costText); self.countText = new Text2('', { size: 50, fill: '#FFD700' }); self.countText.anchor.set(0.5, 0.5); self.countText.x = -150; self.addChild(self.countText); self.lockIcon = null; self.updateButton = function (title, cost, canAfford, count, isLocked, lockMessage) { self.titleText.setText(title); self.costText.setText('$' + cost); if (count !== undefined && count > 0) { self.countText.setText(count.toString()); self.countText.visible = true; } else { self.countText.visible = false; } if (isLocked) { buttonBg.tint = 0x404040; self.interactive = false; // Hide button text when locked self.titleText.visible = false; self.costText.visible = false; self.countText.visible = false; if (!self.lockIcon) { self.lockIcon = self.attachAsset('lock', { anchorX: 0.5, anchorY: 0.5, x: 0, y: -10 }); } self.lockIcon.visible = true; } else { // Show button text when unlocked self.titleText.visible = true; self.costText.visible = true; if (self.lockIcon) { self.lockIcon.visible = false; } buttonBg.tint = canAfford ? 0x4CAF50 : 0x808080; self.interactive = canAfford; } }; self.down = function () { tween(buttonBg, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, onFinish: function onFinish() { tween(buttonBg, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); }; return self; }); var Drum = Container.expand(function () { var self = Container.call(this); var drumGraphics = self.attachAsset('drum', { anchorX: 0.5, anchorY: 0.5 }); // Add permanent drumstick self.drumstick = self.attachAsset('playerDrumstick', { anchorX: 0.5, anchorY: 0.9, x: 210, y: -220, rotation: -0.3 }); self.canTap = true; self.lastTapTime = 0; self.drumstickAnimating = false; self.tap = function () { if (!self.canTap || self.drumstickAnimating) return; var currentTime = Date.now(); var timeSinceLastTap = currentTime - self.lastTapTime; self.lastTapTime = currentTime; // Check for perfect rhythm (60 BPM = 1000ms between beats) var perfectTiming = Math.abs(timeSinceLastTap - 1000) < 100; // Calculate animation speed based on tap speed var tapSpeed = timeSinceLastTap > 0 ? Math.min(timeSinceLastTap, 1000) : 1000; var animationSpeed = tapSpeed / 1000; // Normalize to 0-1 range var strikeDuration = Math.max(50, 150 * animationSpeed); // Faster taps = shorter animation var returnDuration = Math.max(100, 200 * animationSpeed); // Visual feedback - drum scale tween(drumGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(drumGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); // Set animation state self.drumstickAnimating = true; // Animate drumstick strike with dynamic duration - reversed animation tween(self.drumstick, { rotation: -0.6 }, { duration: strikeDuration, easing: tween.easeOut, onFinish: function onFinish() { tween(self.drumstick, { rotation: -0.3 }, { duration: returnDuration, easing: tween.easeInOut, onFinish: function onFinish() { self.drumstickAnimating = false; } }); } }); // Calculate reward var reward = perfectTiming ? goldPerTap * 2 : goldPerTap; var startGold = gold; gold += reward; // Smooth gold animation tween({ value: displayedGold }, { value: gold }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { displayedGold = gold; } }); var tweenObj = { value: displayedGold }; tween(tweenObj, { value: gold }, { duration: 300, easing: tween.easeOut }); Object.defineProperty(tweenObj, 'value', { get: function get() { return displayedGold; }, set: function set(v) { displayedGold = v; } }); // Create light flash effect var lightFlash = self.attachAsset('goldCoin', { anchorX: 0.5, anchorY: 0.5, scaleX: 10, scaleY: 10, alpha: 0.8 }); lightFlash.tint = perfectTiming ? 0xFFD700 : 0xFFFFFF; tween(lightFlash, { scaleX: 15, scaleY: 15, alpha: 0 }, { duration: 300, onFinish: function onFinish() { lightFlash.destroy(); } }); // Create floating text var floatingGold = game.addChild(new FloatingText('+' + reward, perfectTiming ? 0xFFD700 : 0xFFFFFF)); floatingGold.x = self.x; floatingGold.y = self.y - 50; // Play sound LK.getSound('drumhit').play(); // Create music note effect if (perfectTiming) { var note = game.addChild(new MusicNote()); note.x = self.x + (Math.random() - 0.5) * 100; note.y = self.y - 100; } }; self.down = function () { self.tap(); }; return self; }); var FloatingText = Container.expand(function () { var self = Container.call(this); self.init = function (text, color) { self.textObj = new Text2(text, { size: 60, fill: '#' + color.toString(16).padStart(6, '0') }); self.textObj.anchor.set(0.5, 0.5); self.addChild(self.textObj); tween(self, { y: self.y - 100, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var Guitar = Container.expand(function () { var self = Container.call(this); var guitarGraphics = self.attachAsset('guitar', { anchorX: 0.5, anchorY: 0.5 }); self.canPlay = true; self.lastPlayTime = 0; self.play = function () { if (!self.canPlay) return; var currentTime = Date.now(); var timeSinceLastPlay = currentTime - self.lastPlayTime; self.lastPlayTime = currentTime; // Check for perfect rhythm var perfectTiming = Math.abs(timeSinceLastPlay - 1000) < 100; // Visual feedback - guitar scale tween(guitarGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(guitarGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); // Calculate reward var reward = perfectTiming ? goldPerTap * 2 : goldPerTap; var startGold = gold; gold += reward; // Smooth gold animation tween({ value: displayedGold }, { value: gold }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { displayedGold = gold; } }); var tweenObj = { value: displayedGold }; tween(tweenObj, { value: gold }, { duration: 300, easing: tween.easeOut }); Object.defineProperty(tweenObj, 'value', { get: function get() { return displayedGold; }, set: function set(v) { displayedGold = v; } }); // Create light flash effect var lightFlash = self.attachAsset('goldCoin', { anchorX: 0.5, anchorY: 0.5, scaleX: 10, scaleY: 10, alpha: 0.8 }); lightFlash.tint = perfectTiming ? 0xFFD700 : 0xFFFFFF; tween(lightFlash, { scaleX: 15, scaleY: 15, alpha: 0 }, { duration: 300, onFinish: function onFinish() { lightFlash.destroy(); } }); // Create floating text var floatingGold = game.addChild(new FloatingText('+' + reward, perfectTiming ? 0xFFD700 : 0xFFFFFF)); floatingGold.x = self.x; floatingGold.y = self.y - 50; // Play guitar sound LK.getSound('guitarhit').play(); // Create music note effect if (perfectTiming) { var note = game.addChild(new MusicNote()); note.x = self.x + (Math.random() - 0.5) * 100; note.y = self.y - 100; } }; self.down = function () { self.play(); }; return self; }); var MusicNote = Container.expand(function () { var self = Container.call(this); var noteGraphics = self.attachAsset('musicNote', { anchorX: 0.5, anchorY: 0.5 }); tween(self, { y: self.y - 200, alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); tween(noteGraphics, { rotation: Math.PI * 2 }, { duration: 1500 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ // Game variables var gold = 0; var displayedGold = 0; // Track displayed gold for smooth animation var goldPerTap = 1; var passiveIncome = 0; var drumsticks = []; var drumsticksPurchased = 0; var musicians = []; var unlockedInstruments = ['drum']; var currentVenue = 0; var currentInstrument = 'drum'; var instrumentSwitchArrow = null; var guitarAsset = null; var arrowBack = null; var instrumentsPurchased = 0; var audienceCounter = 0; // Track which audience asset to use next var globalClapCounter = 0; // Track global clap count for double clap pattern // Upgrade costs var drumstickCost = 10; var musicianCost = 100; var instrumentCosts = { guitar: 500, saxophone: 1000, violin: 2000 }; // UI Elements var goldText = new Text2('Gold: 0', { size: 80, fill: '#FFD700' }); goldText.anchor.set(0.5, 0); LK.gui.top.addChild(goldText); // Add reset button var resetButton = new Container(); var resetBg = resetButton.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, scaleY: 0.5 }); resetBg.tint = 0xFF0000; var resetText = new Text2('Reset', { size: 30, fill: '#FFFFFF' }); resetText.anchor.set(0.5, 0.5); resetButton.addChild(resetText); resetButton.interactive = true; LK.gui.topRight.addChild(resetButton); resetButton.x = -150; resetButton.y = 50; var incomeText = new Text2('Income: 0/s', { size: 50, fill: '#ffffff' }); incomeText.anchor.set(0.5, 0); incomeText.y = 90; LK.gui.top.addChild(incomeText); // Add background var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Main drum var mainDrum = game.addChild(new Drum()); mainDrum.x = 1024; mainDrum.y = 1300; // Stage/Venue display - removed // Buy buttons - Add to GUI layer to ensure they're always on top var buyDrumstickBtn = LK.gui.bottom.addChild(new BuyButton()); buyDrumstickBtn.x = -480; buyDrumstickBtn.y = -532; buyDrumstickBtn.updateButton('Drumstick', drumstickCost, false); var buyMusicianBtn = LK.gui.bottom.addChild(new BuyButton()); buyMusicianBtn.x = 0; buyMusicianBtn.y = -532; buyMusicianBtn.updateButton('Audience', musicianCost, false, 0, true, ''); var buyInstrumentBtn = LK.gui.bottom.addChild(new BuyButton()); buyInstrumentBtn.x = 480; buyInstrumentBtn.y = -532; buyInstrumentBtn.updateButton('Guitar', instrumentCosts.guitar, false, 0, true, '10 Audience'); // Reset button handler resetButton.down = function () { // Visual feedback tween(resetBg, { scaleX: 0.45, scaleY: 0.45 }, { duration: 100, onFinish: function onFinish() { tween(resetBg, { scaleX: 0.5, scaleY: 0.5 }, { duration: 100 }); } }); }; resetButton.up = function () { // Create confirmation dialog var confirmContainer = game.addChild(new Container()); confirmContainer.x = 1024; confirmContainer.y = 1366; // Dark overlay var overlay = confirmContainer.attachAsset('goldCoin', { anchorX: 0.5, anchorY: 0.5, scaleX: 100, scaleY: 100, alpha: 0.7 }); overlay.tint = 0x000000; // Dialog box var dialogBg = confirmContainer.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); // Confirmation text var confirmText = new Text2('Reset All Progress?', { size: 60, fill: '#FFFFFF' }); confirmText.anchor.set(0.5, 0.5); confirmText.y = -50; confirmContainer.addChild(confirmText); // Yes button var yesBtn = confirmContainer.addChild(new Container()); var yesBg = yesBtn.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); yesBg.tint = 0x4CAF50; var yesText = new Text2('Yes', { size: 40, fill: '#FFFFFF' }); yesText.anchor.set(0.5, 0.5); yesBtn.addChild(yesText); yesBtn.x = -150; yesBtn.y = 50; yesBtn.interactive = true; // No button var noBtn = confirmContainer.addChild(new Container()); var noBg = noBtn.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); noBg.tint = 0xFF0000; var noText = new Text2('No', { size: 40, fill: '#FFFFFF' }); noText.anchor.set(0.5, 0.5); noBtn.addChild(noText); noBtn.x = 150; noBtn.y = 50; noBtn.interactive = true; // Yes button handler yesBtn.down = function () { tween(yesBg, { scaleX: 0.7, scaleY: 0.7 }, { duration: 100, onFinish: function onFinish() { tween(yesBg, { scaleX: 0.8, scaleY: 0.8 }, { duration: 100 }); } }); }; yesBtn.up = function () { // Clear storage storage.gold = null; storage.passiveIncome = null; storage.drumstickCount = null; storage.drumsticksPurchased = null; storage.musicianCount = null; storage.unlockedInstruments = null; storage.instrumentsPurchased = null; // Reload game LK.showGameOver(); }; // No button handler noBtn.down = function () { tween(noBg, { scaleX: 0.7, scaleY: 0.7 }, { duration: 100, onFinish: function onFinish() { tween(noBg, { scaleX: 0.8, scaleY: 0.8 }, { duration: 100 }); } }); }; noBtn.up = function () { confirmContainer.destroy(); }; }; // Button handlers buyDrumstickBtn.up = function () { if (gold >= drumstickCost) { gold -= drumstickCost; drumsticksPurchased++; // Create drumstick if it doesn't exist if (drumsticks.length === 0) { var newStick = game.addChild(new AutoDrumstick()); // Position drumstick on left side of drum newStick.x = mainDrum.x - 350; newStick.y = mainDrum.y - 200; // Rotate drumstick to point towards the drum newStick.rotation = 0; // Set drum reference for visual feedback newStick.drumReference = mainDrum; drumsticks.push(newStick); } passiveIncome += 1; drumstickCost = Math.floor(drumstickCost * 1.5); LK.getSound('purchase').play(); // Force update button to refresh count display buyDrumstickBtn.updateButton('Drumstick', drumstickCost, gold >= drumstickCost, drumsticksPurchased); } }; buyMusicianBtn.up = function () { if (drumsticksPurchased >= 10 && gold >= musicianCost) { gold -= musicianCost; var newAudience = game.addChild(new Audience()); // Random spawn position at bottom of screen newAudience.x = 200 + Math.random() * 1648; // Random x between 200 and 1848 newAudience.y = 2400; // Fixed y position for horizontal alignment if (unlockedInstruments.length > 1) { var randomInstrument = unlockedInstruments[Math.floor(Math.random() * (unlockedInstruments.length - 1)) + 1]; newAudience.setInstrument(randomInstrument); } musicians.push(newAudience); goldPerTap = Math.floor(goldPerTap * newAudience.multiplier); passiveIncome += 4; // Each audience generates 4 gold per second musicianCost = Math.floor(musicianCost * 1.3); LK.getSound('purchase').play(); // Force update button to refresh count display var isLocked = drumsticksPurchased < 10; buyMusicianBtn.updateButton('Audience', musicianCost, gold >= musicianCost && !isLocked, musicians.length, isLocked, isLocked ? '10 Drumsticks' : ''); } }; buyInstrumentBtn.up = function () { var nextInstrument = null; var cost = 0; if (!unlockedInstruments.includes('guitar')) { nextInstrument = 'guitar'; cost = instrumentCosts.guitar; } else if (!unlockedInstruments.includes('saxophone')) { nextInstrument = 'saxophone'; cost = instrumentCosts.saxophone; } else if (!unlockedInstruments.includes('violin')) { nextInstrument = 'violin'; cost = instrumentCosts.violin; } if (nextInstrument && gold >= cost && (nextInstrument !== 'guitar' || musicians.length >= 10)) { gold -= cost; unlockedInstruments.push(nextInstrument); instrumentsPurchased++; LK.getSound('purchase').play(); // Show arrow button when guitar is purchased if (nextInstrument === 'guitar' && !instrumentSwitchArrow) { instrumentSwitchArrow = game.addChild(new ArrowButton()); instrumentSwitchArrow.init('arrow'); instrumentSwitchArrow.x = mainDrum.x + 700; instrumentSwitchArrow.y = mainDrum.y; instrumentSwitchArrow.clickHandler = function () { // Fixed distance between instruments to maintain var INSTRUMENT_DISTANCE = 1200; // Increased distance to ensure they never get close // Smooth transition from drum to guitar with guitar centered if (currentInstrument === 'drum') { var guitarCenterX = 1024; // Center of screen // Calculate drum's new position to maintain distance var drumNewX = guitarCenterX - INSTRUMENT_DISTANCE - 400; // Move drum 400px more to the left // Move drum to the left while maintaining distance tween(mainDrum, { x: drumNewX }, { duration: 500, easing: tween.easeInOut }); // Move drumstick with drum if it exists if (drumsticks.length > 0) { tween(drumsticks[0], { x: drumNewX - 350 }, { duration: 500, easing: tween.easeInOut }); } // Create and bring in guitar from right to center if (!guitarAsset) { guitarAsset = game.addChild(new Guitar()); guitarAsset.scaleX = 3; guitarAsset.scaleY = 3; guitarAsset.x = 2048 + 500; // Start off-screen to the right guitarAsset.y = 1220; guitarAsset.x = guitarAsset.x + 50; // Move slightly to the right } tween(guitarAsset, { x: guitarCenterX // Move to center }, { duration: 500, easing: tween.easeInOut }); // Hide the right arrow instrumentSwitchArrow.visible = false; // Create and show left arrow if it doesn't exist if (!arrowBack) { arrowBack = game.addChild(new ArrowButton()); arrowBack.init('arrowback'); arrowBack.y = mainDrum.y; arrowBack.clickHandler = instrumentSwitchArrow.clickHandler; } arrowBack.x = guitarCenterX - 850; arrowBack.visible = true; currentInstrument = 'guitar'; // Change drumstick button to Finger buyDrumstickBtn.updateButton('Finger', drumstickCost, gold >= drumstickCost, drumsticksPurchased); } else if (currentInstrument === 'guitar') { var drumCenterX = 1024; // Calculate guitar's new position to maintain distance var guitarNewX = drumCenterX + INSTRUMENT_DISTANCE + 400; // Move guitar 400px more to the right // Move guitar to the right maintaining distance tween(guitarAsset, { x: guitarNewX }, { duration: 500, easing: tween.easeInOut }); // Bring drum back to center tween(mainDrum, { x: drumCenterX }, { duration: 500, easing: tween.easeInOut }); // Move drumstick back with drum if it exists if (drumsticks.length > 0) { tween(drumsticks[0], { x: drumCenterX - 350 }, { duration: 500, easing: tween.easeInOut }); } // Show the right arrow again instrumentSwitchArrow.visible = true; instrumentSwitchArrow.x = drumCenterX + 700; // Hide the left arrow if (arrowBack) { arrowBack.visible = false; } currentInstrument = 'drum'; // Change button back to Drumstick buyDrumstickBtn.updateButton('Drumstick', drumstickCost, gold >= drumstickCost, drumsticksPurchased); } }; } // Update button for next instrument if (nextInstrument === 'guitar') { buyInstrumentBtn.updateButton('Saxophone', instrumentCosts.saxophone, gold >= instrumentCosts.saxophone, instrumentsPurchased); } else if (nextInstrument === 'saxophone') { buyInstrumentBtn.updateButton('Violin', instrumentCosts.violin, gold >= instrumentCosts.violin, instrumentsPurchased); } else { buyInstrumentBtn.visible = false; } } }; // Passive income timer var incomeTimer = 0; // Main game loop game.update = function () { // Update UI goldText.setText('Gold: ' + Math.floor(displayedGold)); incomeText.setText('Income: ' + passiveIncome + '/s'); // Update button states var buttonText = currentInstrument === 'guitar' ? 'Finger' : 'Drumstick'; buyDrumstickBtn.updateButton(buttonText, drumstickCost, gold >= drumstickCost, drumsticksPurchased); var isAudienceLocked = drumsticksPurchased < 10; buyMusicianBtn.updateButton('Audience', musicianCost, gold >= musicianCost && !isAudienceLocked, musicians.length, isAudienceLocked, isAudienceLocked ? '10 Drumsticks' : ''); // Update instrument button var nextInstrument = null; var cost = 0; if (!unlockedInstruments.includes('guitar')) { nextInstrument = 'guitar'; cost = instrumentCosts.guitar; } else if (!unlockedInstruments.includes('saxophone')) { nextInstrument = 'saxophone'; cost = instrumentCosts.saxophone; } else if (!unlockedInstruments.includes('violin')) { nextInstrument = 'violin'; cost = instrumentCosts.violin; } if (nextInstrument) { var isGuitarLocked = nextInstrument === 'guitar' && musicians.length < 10; buyInstrumentBtn.updateButton(nextInstrument.charAt(0).toUpperCase() + nextInstrument.slice(1), cost, gold >= cost && !isGuitarLocked, instrumentsPurchased, isGuitarLocked, isGuitarLocked ? '10 Audience' : ''); } // Smooth passive income animation if (passiveIncome > 0 && Math.abs(gold - displayedGold) < 0.1) { // Start a new tween for the next second of income var targetGold = gold + passiveIncome; gold = targetGold; // Update actual gold value tween({ value: displayedGold }, { value: targetGold }, { duration: 1000, onFinish: function onFinish() { displayedGold = targetGold; } }); // Update displayedGold during tween var tweenObj = { value: displayedGold }; tween(tweenObj, { value: targetGold }, { duration: 1000, easing: tween.linear, onFinish: function onFinish() { displayedGold = tweenObj.value; } }); Object.defineProperty(tweenObj, 'value', { get: function get() { return displayedGold; }, set: function set(v) { displayedGold = v; } }); } // Save progress if (LK.ticks % 300 === 0) { storage.gold = gold; storage.passiveIncome = passiveIncome; storage.drumstickCount = drumsticks.length; storage.drumsticksPurchased = drumsticksPurchased; storage.musicianCount = musicians.length; storage.unlockedInstruments = unlockedInstruments; storage.instrumentsPurchased = instrumentsPurchased; } }; // Load saved progress if (storage.gold) { gold = storage.gold || 0; displayedGold = gold; // Initialize displayed gold to match actual gold passiveIncome = storage.passiveIncome || 0; drumsticksPurchased = storage.drumsticksPurchased || 0; unlockedInstruments = storage.unlockedInstruments || ['drum']; instrumentsPurchased = storage.instrumentsPurchased || 0; // Recreate single drumstick if (passiveIncome > 0) { var stick = game.addChild(new AutoDrumstick()); // Position drumstick on left side of drum stick.x = mainDrum.x - 350; stick.y = mainDrum.y - 200; // Rotate drumstick to point towards the drum stick.rotation = 0; // Set drum reference for visual feedback stick.drumReference = mainDrum; drumsticks.push(stick); } // Recreate musicians for (var j = 0; j < (storage.musicianCount || 0); j++) { var audience = game.addChild(new Audience()); // Random spawn position at bottom of screen audience.x = 200 + Math.random() * 1648; // Random x between 200 and 1848 audience.y = 2400; // Fixed y position for horizontal alignment musicians.push(audience); goldPerTap = Math.floor(goldPerTap * audience.multiplier); } } // Play background music LK.playMusic('ambientMusic', { fade: { start: 0, end: 0.3, duration: 2000 } });
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ArrowButton = Container.expand(function () {
var self = Container.call(this);
self.arrowShape = null;
self.assetType = 'arrow'; // Default asset type
self.init = function (assetType) {
if (assetType) {
self.assetType = assetType;
}
self.arrowShape = self.attachAsset(self.assetType, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
};
self.clickHandler = null;
self.down = function () {
if (self.clickHandler) {
self.clickHandler();
}
if (self.arrowShape) {
tween(self.arrowShape, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(self.arrowShape, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
}
};
return self;
});
var Audience = Container.expand(function () {
var self = Container.call(this);
// Select audience asset sequentially
var audienceAssets = ['audience1', 'audience2', 'audience3', 'audience4', 'audience5', 'audience6', 'audience7', 'audience8'];
var selectedAsset = audienceAssets[audienceCounter % audienceAssets.length];
audienceCounter++; // Increment counter for next audience
var audienceGraphics = self.attachAsset(selectedAsset, {
anchorX: 0.5,
anchorY: 0.5
});
self.instrument = null;
self.multiplier = 1.2;
self.update = function () {
// The current implementation already provides the requested pattern
if (LK.ticks % 120 === 0) {
globalClapCounter++;
// Every 3rd clap is a double clap
if (globalClapCounter % 3 === 0) {
// Play double clap
LK.getSound('clap').play();
LK.setTimeout(function () {
LK.getSound('clap').play();
}, 150); // Small delay for "çıt çıt" effect
// Bigger animation for double clap
tween(audienceGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(audienceGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
} else {
// Single clap
LK.getSound('clap').play();
// Small animation when clapping
tween(audienceGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(audienceGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
}
}
};
self.setInstrument = function (type) {
if (self.instrument) {
self.instrument.destroy();
}
self.instrument = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5,
x: 30,
y: 0
});
};
return self;
});
var AutoDrumstick = Container.expand(function () {
var self = Container.call(this);
var stickGraphics = self.attachAsset('drumstick', {
anchorX: 0.5,
anchorY: 0.9
});
self.speed = 1;
self.income = 1000;
self.animating = false;
self.tickCounter = 0;
self.drumReference = null;
self.update = function () {
self.tickCounter++;
// Hit every 60 ticks (60 BPM = 1 hit per second at 60 FPS)
if (self.tickCounter >= 60 && !self.animating) {
self.tickCounter = 0;
self.animate();
}
};
self.animate = function () {
if (self.animating) return;
self.animating = true;
tween(stickGraphics, {
rotation: 0.3
}, {
duration: 300,
onFinish: function onFinish() {
// Generate gold when hitting
var startGold = gold;
gold += self.income;
// Smooth gold animation
tween({
value: displayedGold
}, {
value: gold
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
displayedGold = gold;
}
});
var tweenObj = {
value: displayedGold
};
tween(tweenObj, {
value: gold
}, {
duration: 300,
easing: tween.easeOut
});
Object.defineProperty(tweenObj, 'value', {
get: function get() {
return displayedGold;
},
set: function set(v) {
displayedGold = v;
}
});
// Play drum sound
LK.getSound('drumhit').play();
// Visual feedback on drum if reference exists
if (self.drumReference) {
var drumGraphics = self.drumReference.children[0];
tween(drumGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 50,
onFinish: function onFinish() {
tween(drumGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 50
});
}
});
}
tween(stickGraphics, {
rotation: 0
}, {
duration: 200,
onFinish: function onFinish() {
self.animating = false;
}
});
}
});
};
return self;
});
var BuyButton = Container.expand(function () {
var self = Container.call(this);
var buttonBg = self.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.titleText = new Text2('', {
size: 40,
fill: '#ffffff'
});
self.titleText.anchor.set(0.5, 0.5);
self.titleText.y = -15;
self.addChild(self.titleText);
self.costText = new Text2('', {
size: 30,
fill: '#ffffff'
});
self.costText.anchor.set(0.5, 0.5);
self.costText.y = 15;
self.addChild(self.costText);
self.countText = new Text2('', {
size: 50,
fill: '#FFD700'
});
self.countText.anchor.set(0.5, 0.5);
self.countText.x = -150;
self.addChild(self.countText);
self.lockIcon = null;
self.updateButton = function (title, cost, canAfford, count, isLocked, lockMessage) {
self.titleText.setText(title);
self.costText.setText('$' + cost);
if (count !== undefined && count > 0) {
self.countText.setText(count.toString());
self.countText.visible = true;
} else {
self.countText.visible = false;
}
if (isLocked) {
buttonBg.tint = 0x404040;
self.interactive = false;
// Hide button text when locked
self.titleText.visible = false;
self.costText.visible = false;
self.countText.visible = false;
if (!self.lockIcon) {
self.lockIcon = self.attachAsset('lock', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -10
});
}
self.lockIcon.visible = true;
} else {
// Show button text when unlocked
self.titleText.visible = true;
self.costText.visible = true;
if (self.lockIcon) {
self.lockIcon.visible = false;
}
buttonBg.tint = canAfford ? 0x4CAF50 : 0x808080;
self.interactive = canAfford;
}
};
self.down = function () {
tween(buttonBg, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
onFinish: function onFinish() {
tween(buttonBg, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
};
return self;
});
var Drum = Container.expand(function () {
var self = Container.call(this);
var drumGraphics = self.attachAsset('drum', {
anchorX: 0.5,
anchorY: 0.5
});
// Add permanent drumstick
self.drumstick = self.attachAsset('playerDrumstick', {
anchorX: 0.5,
anchorY: 0.9,
x: 210,
y: -220,
rotation: -0.3
});
self.canTap = true;
self.lastTapTime = 0;
self.drumstickAnimating = false;
self.tap = function () {
if (!self.canTap || self.drumstickAnimating) return;
var currentTime = Date.now();
var timeSinceLastTap = currentTime - self.lastTapTime;
self.lastTapTime = currentTime;
// Check for perfect rhythm (60 BPM = 1000ms between beats)
var perfectTiming = Math.abs(timeSinceLastTap - 1000) < 100;
// Calculate animation speed based on tap speed
var tapSpeed = timeSinceLastTap > 0 ? Math.min(timeSinceLastTap, 1000) : 1000;
var animationSpeed = tapSpeed / 1000; // Normalize to 0-1 range
var strikeDuration = Math.max(50, 150 * animationSpeed); // Faster taps = shorter animation
var returnDuration = Math.max(100, 200 * animationSpeed);
// Visual feedback - drum scale
tween(drumGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(drumGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
// Set animation state
self.drumstickAnimating = true;
// Animate drumstick strike with dynamic duration - reversed animation
tween(self.drumstick, {
rotation: -0.6
}, {
duration: strikeDuration,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self.drumstick, {
rotation: -0.3
}, {
duration: returnDuration,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.drumstickAnimating = false;
}
});
}
});
// Calculate reward
var reward = perfectTiming ? goldPerTap * 2 : goldPerTap;
var startGold = gold;
gold += reward;
// Smooth gold animation
tween({
value: displayedGold
}, {
value: gold
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
displayedGold = gold;
}
});
var tweenObj = {
value: displayedGold
};
tween(tweenObj, {
value: gold
}, {
duration: 300,
easing: tween.easeOut
});
Object.defineProperty(tweenObj, 'value', {
get: function get() {
return displayedGold;
},
set: function set(v) {
displayedGold = v;
}
});
// Create light flash effect
var lightFlash = self.attachAsset('goldCoin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 10,
scaleY: 10,
alpha: 0.8
});
lightFlash.tint = perfectTiming ? 0xFFD700 : 0xFFFFFF;
tween(lightFlash, {
scaleX: 15,
scaleY: 15,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
lightFlash.destroy();
}
});
// Create floating text
var floatingGold = game.addChild(new FloatingText('+' + reward, perfectTiming ? 0xFFD700 : 0xFFFFFF));
floatingGold.x = self.x;
floatingGold.y = self.y - 50;
// Play sound
LK.getSound('drumhit').play();
// Create music note effect
if (perfectTiming) {
var note = game.addChild(new MusicNote());
note.x = self.x + (Math.random() - 0.5) * 100;
note.y = self.y - 100;
}
};
self.down = function () {
self.tap();
};
return self;
});
var FloatingText = Container.expand(function () {
var self = Container.call(this);
self.init = function (text, color) {
self.textObj = new Text2(text, {
size: 60,
fill: '#' + color.toString(16).padStart(6, '0')
});
self.textObj.anchor.set(0.5, 0.5);
self.addChild(self.textObj);
tween(self, {
y: self.y - 100,
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var Guitar = Container.expand(function () {
var self = Container.call(this);
var guitarGraphics = self.attachAsset('guitar', {
anchorX: 0.5,
anchorY: 0.5
});
self.canPlay = true;
self.lastPlayTime = 0;
self.play = function () {
if (!self.canPlay) return;
var currentTime = Date.now();
var timeSinceLastPlay = currentTime - self.lastPlayTime;
self.lastPlayTime = currentTime;
// Check for perfect rhythm
var perfectTiming = Math.abs(timeSinceLastPlay - 1000) < 100;
// Visual feedback - guitar scale
tween(guitarGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(guitarGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
// Calculate reward
var reward = perfectTiming ? goldPerTap * 2 : goldPerTap;
var startGold = gold;
gold += reward;
// Smooth gold animation
tween({
value: displayedGold
}, {
value: gold
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
displayedGold = gold;
}
});
var tweenObj = {
value: displayedGold
};
tween(tweenObj, {
value: gold
}, {
duration: 300,
easing: tween.easeOut
});
Object.defineProperty(tweenObj, 'value', {
get: function get() {
return displayedGold;
},
set: function set(v) {
displayedGold = v;
}
});
// Create light flash effect
var lightFlash = self.attachAsset('goldCoin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 10,
scaleY: 10,
alpha: 0.8
});
lightFlash.tint = perfectTiming ? 0xFFD700 : 0xFFFFFF;
tween(lightFlash, {
scaleX: 15,
scaleY: 15,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
lightFlash.destroy();
}
});
// Create floating text
var floatingGold = game.addChild(new FloatingText('+' + reward, perfectTiming ? 0xFFD700 : 0xFFFFFF));
floatingGold.x = self.x;
floatingGold.y = self.y - 50;
// Play guitar sound
LK.getSound('guitarhit').play();
// Create music note effect
if (perfectTiming) {
var note = game.addChild(new MusicNote());
note.x = self.x + (Math.random() - 0.5) * 100;
note.y = self.y - 100;
}
};
self.down = function () {
self.play();
};
return self;
});
var MusicNote = Container.expand(function () {
var self = Container.call(this);
var noteGraphics = self.attachAsset('musicNote', {
anchorX: 0.5,
anchorY: 0.5
});
tween(self, {
y: self.y - 200,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
tween(noteGraphics, {
rotation: Math.PI * 2
}, {
duration: 1500
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Game variables
var gold = 0;
var displayedGold = 0; // Track displayed gold for smooth animation
var goldPerTap = 1;
var passiveIncome = 0;
var drumsticks = [];
var drumsticksPurchased = 0;
var musicians = [];
var unlockedInstruments = ['drum'];
var currentVenue = 0;
var currentInstrument = 'drum';
var instrumentSwitchArrow = null;
var guitarAsset = null;
var arrowBack = null;
var instrumentsPurchased = 0;
var audienceCounter = 0; // Track which audience asset to use next
var globalClapCounter = 0; // Track global clap count for double clap pattern
// Upgrade costs
var drumstickCost = 10;
var musicianCost = 100;
var instrumentCosts = {
guitar: 500,
saxophone: 1000,
violin: 2000
};
// UI Elements
var goldText = new Text2('Gold: 0', {
size: 80,
fill: '#FFD700'
});
goldText.anchor.set(0.5, 0);
LK.gui.top.addChild(goldText);
// Add reset button
var resetButton = new Container();
var resetBg = resetButton.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5
});
resetBg.tint = 0xFF0000;
var resetText = new Text2('Reset', {
size: 30,
fill: '#FFFFFF'
});
resetText.anchor.set(0.5, 0.5);
resetButton.addChild(resetText);
resetButton.interactive = true;
LK.gui.topRight.addChild(resetButton);
resetButton.x = -150;
resetButton.y = 50;
var incomeText = new Text2('Income: 0/s', {
size: 50,
fill: '#ffffff'
});
incomeText.anchor.set(0.5, 0);
incomeText.y = 90;
LK.gui.top.addChild(incomeText);
// Add background
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Main drum
var mainDrum = game.addChild(new Drum());
mainDrum.x = 1024;
mainDrum.y = 1300;
// Stage/Venue display - removed
// Buy buttons - Add to GUI layer to ensure they're always on top
var buyDrumstickBtn = LK.gui.bottom.addChild(new BuyButton());
buyDrumstickBtn.x = -480;
buyDrumstickBtn.y = -532;
buyDrumstickBtn.updateButton('Drumstick', drumstickCost, false);
var buyMusicianBtn = LK.gui.bottom.addChild(new BuyButton());
buyMusicianBtn.x = 0;
buyMusicianBtn.y = -532;
buyMusicianBtn.updateButton('Audience', musicianCost, false, 0, true, '');
var buyInstrumentBtn = LK.gui.bottom.addChild(new BuyButton());
buyInstrumentBtn.x = 480;
buyInstrumentBtn.y = -532;
buyInstrumentBtn.updateButton('Guitar', instrumentCosts.guitar, false, 0, true, '10 Audience');
// Reset button handler
resetButton.down = function () {
// Visual feedback
tween(resetBg, {
scaleX: 0.45,
scaleY: 0.45
}, {
duration: 100,
onFinish: function onFinish() {
tween(resetBg, {
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 100
});
}
});
};
resetButton.up = function () {
// Create confirmation dialog
var confirmContainer = game.addChild(new Container());
confirmContainer.x = 1024;
confirmContainer.y = 1366;
// Dark overlay
var overlay = confirmContainer.attachAsset('goldCoin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 100,
scaleY: 100,
alpha: 0.7
});
overlay.tint = 0x000000;
// Dialog box
var dialogBg = confirmContainer.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
// Confirmation text
var confirmText = new Text2('Reset All Progress?', {
size: 60,
fill: '#FFFFFF'
});
confirmText.anchor.set(0.5, 0.5);
confirmText.y = -50;
confirmContainer.addChild(confirmText);
// Yes button
var yesBtn = confirmContainer.addChild(new Container());
var yesBg = yesBtn.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
yesBg.tint = 0x4CAF50;
var yesText = new Text2('Yes', {
size: 40,
fill: '#FFFFFF'
});
yesText.anchor.set(0.5, 0.5);
yesBtn.addChild(yesText);
yesBtn.x = -150;
yesBtn.y = 50;
yesBtn.interactive = true;
// No button
var noBtn = confirmContainer.addChild(new Container());
var noBg = noBtn.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
noBg.tint = 0xFF0000;
var noText = new Text2('No', {
size: 40,
fill: '#FFFFFF'
});
noText.anchor.set(0.5, 0.5);
noBtn.addChild(noText);
noBtn.x = 150;
noBtn.y = 50;
noBtn.interactive = true;
// Yes button handler
yesBtn.down = function () {
tween(yesBg, {
scaleX: 0.7,
scaleY: 0.7
}, {
duration: 100,
onFinish: function onFinish() {
tween(yesBg, {
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 100
});
}
});
};
yesBtn.up = function () {
// Clear storage
storage.gold = null;
storage.passiveIncome = null;
storage.drumstickCount = null;
storage.drumsticksPurchased = null;
storage.musicianCount = null;
storage.unlockedInstruments = null;
storage.instrumentsPurchased = null;
// Reload game
LK.showGameOver();
};
// No button handler
noBtn.down = function () {
tween(noBg, {
scaleX: 0.7,
scaleY: 0.7
}, {
duration: 100,
onFinish: function onFinish() {
tween(noBg, {
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 100
});
}
});
};
noBtn.up = function () {
confirmContainer.destroy();
};
};
// Button handlers
buyDrumstickBtn.up = function () {
if (gold >= drumstickCost) {
gold -= drumstickCost;
drumsticksPurchased++;
// Create drumstick if it doesn't exist
if (drumsticks.length === 0) {
var newStick = game.addChild(new AutoDrumstick());
// Position drumstick on left side of drum
newStick.x = mainDrum.x - 350;
newStick.y = mainDrum.y - 200;
// Rotate drumstick to point towards the drum
newStick.rotation = 0;
// Set drum reference for visual feedback
newStick.drumReference = mainDrum;
drumsticks.push(newStick);
}
passiveIncome += 1;
drumstickCost = Math.floor(drumstickCost * 1.5);
LK.getSound('purchase').play();
// Force update button to refresh count display
buyDrumstickBtn.updateButton('Drumstick', drumstickCost, gold >= drumstickCost, drumsticksPurchased);
}
};
buyMusicianBtn.up = function () {
if (drumsticksPurchased >= 10 && gold >= musicianCost) {
gold -= musicianCost;
var newAudience = game.addChild(new Audience());
// Random spawn position at bottom of screen
newAudience.x = 200 + Math.random() * 1648; // Random x between 200 and 1848
newAudience.y = 2400; // Fixed y position for horizontal alignment
if (unlockedInstruments.length > 1) {
var randomInstrument = unlockedInstruments[Math.floor(Math.random() * (unlockedInstruments.length - 1)) + 1];
newAudience.setInstrument(randomInstrument);
}
musicians.push(newAudience);
goldPerTap = Math.floor(goldPerTap * newAudience.multiplier);
passiveIncome += 4; // Each audience generates 4 gold per second
musicianCost = Math.floor(musicianCost * 1.3);
LK.getSound('purchase').play();
// Force update button to refresh count display
var isLocked = drumsticksPurchased < 10;
buyMusicianBtn.updateButton('Audience', musicianCost, gold >= musicianCost && !isLocked, musicians.length, isLocked, isLocked ? '10 Drumsticks' : '');
}
};
buyInstrumentBtn.up = function () {
var nextInstrument = null;
var cost = 0;
if (!unlockedInstruments.includes('guitar')) {
nextInstrument = 'guitar';
cost = instrumentCosts.guitar;
} else if (!unlockedInstruments.includes('saxophone')) {
nextInstrument = 'saxophone';
cost = instrumentCosts.saxophone;
} else if (!unlockedInstruments.includes('violin')) {
nextInstrument = 'violin';
cost = instrumentCosts.violin;
}
if (nextInstrument && gold >= cost && (nextInstrument !== 'guitar' || musicians.length >= 10)) {
gold -= cost;
unlockedInstruments.push(nextInstrument);
instrumentsPurchased++;
LK.getSound('purchase').play();
// Show arrow button when guitar is purchased
if (nextInstrument === 'guitar' && !instrumentSwitchArrow) {
instrumentSwitchArrow = game.addChild(new ArrowButton());
instrumentSwitchArrow.init('arrow');
instrumentSwitchArrow.x = mainDrum.x + 700;
instrumentSwitchArrow.y = mainDrum.y;
instrumentSwitchArrow.clickHandler = function () {
// Fixed distance between instruments to maintain
var INSTRUMENT_DISTANCE = 1200; // Increased distance to ensure they never get close
// Smooth transition from drum to guitar with guitar centered
if (currentInstrument === 'drum') {
var guitarCenterX = 1024; // Center of screen
// Calculate drum's new position to maintain distance
var drumNewX = guitarCenterX - INSTRUMENT_DISTANCE - 400; // Move drum 400px more to the left
// Move drum to the left while maintaining distance
tween(mainDrum, {
x: drumNewX
}, {
duration: 500,
easing: tween.easeInOut
});
// Move drumstick with drum if it exists
if (drumsticks.length > 0) {
tween(drumsticks[0], {
x: drumNewX - 350
}, {
duration: 500,
easing: tween.easeInOut
});
}
// Create and bring in guitar from right to center
if (!guitarAsset) {
guitarAsset = game.addChild(new Guitar());
guitarAsset.scaleX = 3;
guitarAsset.scaleY = 3;
guitarAsset.x = 2048 + 500; // Start off-screen to the right
guitarAsset.y = 1220;
guitarAsset.x = guitarAsset.x + 50; // Move slightly to the right
}
tween(guitarAsset, {
x: guitarCenterX // Move to center
}, {
duration: 500,
easing: tween.easeInOut
});
// Hide the right arrow
instrumentSwitchArrow.visible = false;
// Create and show left arrow if it doesn't exist
if (!arrowBack) {
arrowBack = game.addChild(new ArrowButton());
arrowBack.init('arrowback');
arrowBack.y = mainDrum.y;
arrowBack.clickHandler = instrumentSwitchArrow.clickHandler;
}
arrowBack.x = guitarCenterX - 850;
arrowBack.visible = true;
currentInstrument = 'guitar';
// Change drumstick button to Finger
buyDrumstickBtn.updateButton('Finger', drumstickCost, gold >= drumstickCost, drumsticksPurchased);
} else if (currentInstrument === 'guitar') {
var drumCenterX = 1024;
// Calculate guitar's new position to maintain distance
var guitarNewX = drumCenterX + INSTRUMENT_DISTANCE + 400; // Move guitar 400px more to the right
// Move guitar to the right maintaining distance
tween(guitarAsset, {
x: guitarNewX
}, {
duration: 500,
easing: tween.easeInOut
});
// Bring drum back to center
tween(mainDrum, {
x: drumCenterX
}, {
duration: 500,
easing: tween.easeInOut
});
// Move drumstick back with drum if it exists
if (drumsticks.length > 0) {
tween(drumsticks[0], {
x: drumCenterX - 350
}, {
duration: 500,
easing: tween.easeInOut
});
}
// Show the right arrow again
instrumentSwitchArrow.visible = true;
instrumentSwitchArrow.x = drumCenterX + 700;
// Hide the left arrow
if (arrowBack) {
arrowBack.visible = false;
}
currentInstrument = 'drum';
// Change button back to Drumstick
buyDrumstickBtn.updateButton('Drumstick', drumstickCost, gold >= drumstickCost, drumsticksPurchased);
}
};
}
// Update button for next instrument
if (nextInstrument === 'guitar') {
buyInstrumentBtn.updateButton('Saxophone', instrumentCosts.saxophone, gold >= instrumentCosts.saxophone, instrumentsPurchased);
} else if (nextInstrument === 'saxophone') {
buyInstrumentBtn.updateButton('Violin', instrumentCosts.violin, gold >= instrumentCosts.violin, instrumentsPurchased);
} else {
buyInstrumentBtn.visible = false;
}
}
};
// Passive income timer
var incomeTimer = 0;
// Main game loop
game.update = function () {
// Update UI
goldText.setText('Gold: ' + Math.floor(displayedGold));
incomeText.setText('Income: ' + passiveIncome + '/s');
// Update button states
var buttonText = currentInstrument === 'guitar' ? 'Finger' : 'Drumstick';
buyDrumstickBtn.updateButton(buttonText, drumstickCost, gold >= drumstickCost, drumsticksPurchased);
var isAudienceLocked = drumsticksPurchased < 10;
buyMusicianBtn.updateButton('Audience', musicianCost, gold >= musicianCost && !isAudienceLocked, musicians.length, isAudienceLocked, isAudienceLocked ? '10 Drumsticks' : '');
// Update instrument button
var nextInstrument = null;
var cost = 0;
if (!unlockedInstruments.includes('guitar')) {
nextInstrument = 'guitar';
cost = instrumentCosts.guitar;
} else if (!unlockedInstruments.includes('saxophone')) {
nextInstrument = 'saxophone';
cost = instrumentCosts.saxophone;
} else if (!unlockedInstruments.includes('violin')) {
nextInstrument = 'violin';
cost = instrumentCosts.violin;
}
if (nextInstrument) {
var isGuitarLocked = nextInstrument === 'guitar' && musicians.length < 10;
buyInstrumentBtn.updateButton(nextInstrument.charAt(0).toUpperCase() + nextInstrument.slice(1), cost, gold >= cost && !isGuitarLocked, instrumentsPurchased, isGuitarLocked, isGuitarLocked ? '10 Audience' : '');
}
// Smooth passive income animation
if (passiveIncome > 0 && Math.abs(gold - displayedGold) < 0.1) {
// Start a new tween for the next second of income
var targetGold = gold + passiveIncome;
gold = targetGold; // Update actual gold value
tween({
value: displayedGold
}, {
value: targetGold
}, {
duration: 1000,
onFinish: function onFinish() {
displayedGold = targetGold;
}
});
// Update displayedGold during tween
var tweenObj = {
value: displayedGold
};
tween(tweenObj, {
value: targetGold
}, {
duration: 1000,
easing: tween.linear,
onFinish: function onFinish() {
displayedGold = tweenObj.value;
}
});
Object.defineProperty(tweenObj, 'value', {
get: function get() {
return displayedGold;
},
set: function set(v) {
displayedGold = v;
}
});
}
// Save progress
if (LK.ticks % 300 === 0) {
storage.gold = gold;
storage.passiveIncome = passiveIncome;
storage.drumstickCount = drumsticks.length;
storage.drumsticksPurchased = drumsticksPurchased;
storage.musicianCount = musicians.length;
storage.unlockedInstruments = unlockedInstruments;
storage.instrumentsPurchased = instrumentsPurchased;
}
};
// Load saved progress
if (storage.gold) {
gold = storage.gold || 0;
displayedGold = gold; // Initialize displayed gold to match actual gold
passiveIncome = storage.passiveIncome || 0;
drumsticksPurchased = storage.drumsticksPurchased || 0;
unlockedInstruments = storage.unlockedInstruments || ['drum'];
instrumentsPurchased = storage.instrumentsPurchased || 0;
// Recreate single drumstick
if (passiveIncome > 0) {
var stick = game.addChild(new AutoDrumstick());
// Position drumstick on left side of drum
stick.x = mainDrum.x - 350;
stick.y = mainDrum.y - 200;
// Rotate drumstick to point towards the drum
stick.rotation = 0;
// Set drum reference for visual feedback
stick.drumReference = mainDrum;
drumsticks.push(stick);
}
// Recreate musicians
for (var j = 0; j < (storage.musicianCount || 0); j++) {
var audience = game.addChild(new Audience());
// Random spawn position at bottom of screen
audience.x = 200 + Math.random() * 1648; // Random x between 200 and 1848
audience.y = 2400; // Fixed y position for horizontal alignment
musicians.push(audience);
goldPerTap = Math.floor(goldPerTap * audience.multiplier);
}
}
// Play background music
LK.playMusic('ambientMusic', {
fade: {
start: 0,
end: 0.3,
duration: 2000
}
});
Horizontal drumstick for drum 2d pixelart. In-Game asset. 2d. High contrast. No shadows
Drum 2d pixelart. In-Game asset. 2d. no drums
detailed brunette woman from behind pixel art 2d. In-Game asset. 2d. High contrast. No shadows
man pixel art with different clothes
brown yellow haired man pixel art
yellow plus brown haired man pixel art with different colors of clothing
guitar pixel art 2d horizontal. In-Game asset. 2d. High contrast. No shadows
lock pixel art. In-Game asset. 2d. High contrast. No shadows
cymbal instrument pixel art 2d. In-Game asset. 2d. High contrast. No shadows
straight stick pixel art horizontal 2d. In-Game asset. 2d. High contrast. No shadows
maracas instrument pixelart vertical 2d. In-Game asset. 2d. High contrast. No shadows
piano pixelart 2d. In-Game asset. 2d. High contrast. No shadows
pianist man with hat from behind standing in chair without piano pixel art 2d
flute pixel art 2d vertical. In-Game asset. 2d. High contrast. No shadows
disco ball pixel art 2d. In-Game asset. 2d. High contrast. No shadows
Pixel art style
Confetti stick, 2d pixel art vertical. no papers only stick. In-Game asset. 2d. High contrast. No shadows
disco ball pixel art 2d. In-Game asset. 2d. High contrast. No shadows
Make different variations this pixel art change clothes, change hairstyle
make different variations of this pixel art change hairstyle, clothing
make different hairstyle and clothing, you can use cap etc.
make different hairstyle and clothing
make different hairstyle and clothing
make different hairstyle and clothing, you can make punk
make different clothing, you can make it blonde
make different hairstyle and clothing, you can make man wearing hoodie
One Confetti paper pixelart 2d. In-Game asset. 2d. High contrast. No shadows
Remove band clicker write, make drum in the middle
Make it red
Make it green
Make it blue
make it white
make it purple
#F3D296 colour small arrow pixel art. In-Game asset. 2d. High contrast. No shadows
Change writing to the ''MENU''
Make empty pixel art game card. #f3d296 color. In-Game asset. 2d. High quality. No shadows
Remove ball,
Remove stick, left ball alone
Change writing to the ''BPM OPTIONS'' pixel art
Make audio's lines dark black, audio color dark gray. Make x's lines black and inside color red.
Remove audio, left x
Make it brown
Can you make it lighter
make it #7d522e
Money gun pixel art. Without money, horizontal. In-Game asset. 2d. High contrast. No shadows
Make it red box
Make it resd