User prompt
As the levels increase, so the enemy mage fires faster every time he dies.
User prompt
When the opposing wizard dies, put a screen like the win screen so that the player understands that he has moved on to the next level and write "Level 1 completed" under it and continue.
User prompt
Add startNextLevel function to handle level progression
User prompt
go straight to the opponent and do not fall down ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Don't fall down, go straight ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let those spellers turn and go to each other ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Our character's and the other opponent character's spells should be separate and one should go from the top and the other from the bottom, so they don't mix with each other and the spells should go in a rotation. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
play a different rhythm or music when each note is pressed ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the opposing mage fire slower and the yellow balls that appear when he fires will go a little higher. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Put 2 more different notes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
remove the rings, put notes instead of the w a s d keys
User prompt
The rings should not be intertwined with each other and the keys should come more slowly. If that key is pressed while the keys are touching the ring, the character will cast an ability (i.e. send a spell to the opponent). ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The rings should be in the same order and size as the keys coming out of there, not overlapping each other, the keys should come slower and if they touch the ring, our character should cast an ability
User prompt
Let it go to the left side of the screen and exit the screen from there. There will be 4 rings lined up one below the other between the top of our wizard's head and the health bars. When the o key is pressed while passing through these rings, our character will cast a spell.
User prompt
Let the w a s d keys come from the right between the enemy wizard's head and the health bar (the keys should come from the right side of the screen, one under the other) and let there be 4 empty rings on top of each other on our character on the left. When the o key is pressed while inside these rings, the ability is cast.
User prompt
there should be no up arrow key (shown in purple (shown as up)) and the w a s d keys should come from the right above the wizards and there should be 4 hollow rings on top of each other above our character on the left. When the o key is pressed while inside these rings, the ability should be cast (when it shines at the bottom, it should not cast the ability when pressed)
Code edit (1 edits merged)
Please save this source code
User prompt
Wizard Beat Battle
Initial prompt
There will be 2 fighting wizards on the screen. They will do their combos, hits, and moves by pressing the w a s d keys at the right time and with each correct key the wizard will dance and cast a spell on his opponent with the music. It's like the "Friday Night Funkin'" game but instead of characters there will be wizards and they will dance and cast spells on each other with the music. The keys can also be the arrow keys.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var RhythmButton = Container.expand(function (buttonType) { var self = Container.call(this); var buttonGraphics = self.attachAsset('button' + buttonType, { anchorX: 0.5, anchorY: 0.5 }); self.buttonType = buttonType; self.isActive = false; self.originalScale = 1; self.activate = function () { self.isActive = true; // Move button from right side to left side of screen tween(self, { x: -200 // Move to left side and exit screen }, { duration: beatInterval * 1.5 // Move across entire screen }); tween(buttonGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100 }); tween(buttonGraphics, { alpha: 1 }, { duration: 100 }); }; self.deactivate = function () { self.isActive = false; // Reset button position back to right side self.x = 2100; tween(buttonGraphics, { scaleX: 1, scaleY: 1 }, { duration: 200 }); tween(buttonGraphics, { alpha: 0.6 }, { duration: 200 }); }; self.hit = function () { LK.getSound('buttonHit').play(); tween(buttonGraphics, { scaleX: 0.8, scaleY: 0.8 }, { duration: 50, onFinish: function onFinish() { tween(buttonGraphics, { scaleX: 1, scaleY: 1 }, { duration: 50 }); } }); }; // Set initial alpha buttonGraphics.alpha = 0.6; self.down = function (x, y, obj) { if (self.isActive) { self.hit(); return true; } return false; }; return self; }); var Spell = Container.expand(function () { var self = Container.call(this); var spellGraphics = self.attachAsset('spell', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.direction = 1; // 1 for right, -1 for left self.update = function () { self.x += self.speed * self.direction; // Remove spell if it goes off screen if (self.x > 2200 || self.x < -200) { self.destroy(); } }; return self; }); var TargetRing = Container.expand(function () { var self = Container.call(this); var ringGraphics = self.attachAsset('targetRing', { anchorX: 0.5, anchorY: 0.5 }); self.isActive = false; self.originalAlpha = 0.3; ringGraphics.alpha = self.originalAlpha; // Make ring hollow by scaling down and creating border effect ringGraphics.scaleX = 1; ringGraphics.scaleY = 1; self.activate = function () { self.isActive = true; tween(ringGraphics, { alpha: 1, scaleX: 1.2, scaleY: 1.2 }, { duration: 200 }); }; self.deactivate = function () { self.isActive = false; tween(ringGraphics, { alpha: self.originalAlpha, scaleX: 1, scaleY: 1 }, { duration: 200 }); }; self.down = function (x, y, obj) { if (self.isActive) { // Cast ability LK.getSound('spellCast').play(); playerWizard.castSpell(); playerWizard.dance(); self.deactivate(); return true; } return false; }; return self; }); var Wizard = Container.expand(function (isPlayer) { var self = Container.call(this); var wizardAsset = isPlayer ? 'wizard' : 'enemyWizard'; var wizardGraphics = self.attachAsset(wizardAsset, { anchorX: 0.5, anchorY: 1 }); self.isPlayer = isPlayer; self.maxHealth = 100; self.health = self.maxHealth; self.isDancing = false; self.dance = function () { if (self.isDancing) return; self.isDancing = true; var originalY = self.y; tween(self, { y: originalY - 30 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { y: originalY }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { self.isDancing = false; } }); } }); tween(wizardGraphics, { rotation: 0.2 }, { duration: 100, onFinish: function onFinish() { tween(wizardGraphics, { rotation: -0.2 }, { duration: 200, onFinish: function onFinish() { tween(wizardGraphics, { rotation: 0 }, { duration: 100 }); } }); } }); }; self.castSpell = function () { var spell = new Spell(); spell.x = self.x; spell.y = self.y - 150; spell.direction = self.isPlayer ? 1 : -1; game.addChild(spell); spells.push(spell); LK.getSound('spellCast').play(); LK.effects.flashObject(self, 0xffd700, 300); }; self.takeDamage = function (damage) { self.health = Math.max(0, self.health - damage); LK.getSound('wizardHit').play(); LK.effects.flashObject(self, 0xff0000, 500); if (self.health <= 0) { self.die(); } }; self.die = function () { tween(wizardGraphics, { alpha: 0.3, scaleX: 0.8, scaleY: 0.8 }, { duration: 1000 }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ // Game variables var playerWizard; var enemyWizard; var rhythmButtons = []; var spells = []; var currentBeat = 0; var beatInterval = 600; // milliseconds between beats var lastBeatTime = 0; var gameActive = true; var playerHealth; var enemyHealth; var playerHealthBar; var enemyHealthBar; var score = 0; var combo = 0; // Beat pattern for the song var beatPattern = ['W', 'A', 'S', 'D', 'W', 'S', 'A', 'D']; var patternIndex = 0; // Create wizards playerWizard = game.addChild(new Wizard(true)); playerWizard.x = 400; playerWizard.y = 2200; enemyWizard = game.addChild(new Wizard(false)); enemyWizard.x = 1648; enemyWizard.y = 2200; // Create health bars var playerHealthBg = LK.getAsset('healthBarBg', { anchorX: 0, anchorY: 0.5 }); playerHealthBg.x = 50; playerHealthBg.y = 150; game.addChild(playerHealthBg); playerHealthBar = LK.getAsset('healthBar', { anchorX: 0, anchorY: 0.5 }); playerHealthBar.x = 55; playerHealthBar.y = 150; game.addChild(playerHealthBar); var enemyHealthBg = LK.getAsset('healthBarBg', { anchorX: 1, anchorY: 0.5 }); enemyHealthBg.x = 1998; enemyHealthBg.y = 150; game.addChild(enemyHealthBg); enemyHealthBar = LK.getAsset('healthBar', { anchorX: 1, anchorY: 0.5 }); enemyHealthBar.x = 1993; enemyHealthBar.y = 150; game.addChild(enemyHealthBar); // Create rhythm buttons positioned from the right between enemy wizard head and health bar var buttonTypes = ['W', 'A', 'S', 'D']; var buttonStartX = 2100; // Start from right side of screen var buttonY = 400; // Between enemy wizard head and health bar var buttonSpacing = 100; // Vertical spacing between buttons for (var i = 0; i < buttonTypes.length; i++) { var button = new RhythmButton(buttonTypes[i]); button.x = buttonStartX; button.y = buttonY + i * buttonSpacing; // Stack vertically, one under the other rhythmButtons.push(button); game.addChild(button); } // Create 4 target rings between wizard head and health bars var targetRings = []; for (var i = 0; i < 4; i++) { var ring = new TargetRing(); ring.x = playerWizard.x; ring.y = 300 + i * 80; // Position between wizard head and health bars, stacked vertically targetRings.push(ring); game.addChild(ring); } // Variables for ring activation var currentActiveRing = 0; var ringActivationTimer = null; // Score display var scoreText = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Combo display var comboText = new Text2('Combo: 0', { size: 60, fill: 0xFFD700 }); comboText.anchor.set(0.5, 0); comboText.y = 100; LK.gui.top.addChild(comboText); // Start music LK.playMusic('battleMusic'); // Beat timer var beatTimer = LK.setInterval(function () { if (!gameActive) return; currentBeat++; var currentButton = beatPattern[patternIndex % beatPattern.length]; patternIndex++; // Deactivate all buttons for (var i = 0; i < rhythmButtons.length; i++) { rhythmButtons[i].deactivate(); } // Activate current button for (var i = 0; i < rhythmButtons.length; i++) { if (rhythmButtons[i].buttonType === currentButton) { rhythmButtons[i].activate(); break; } } // Enemy AI - sometimes hits the beat if (Math.random() < 0.7) { // 70% chance enemy hits LK.setTimeout(function () { enemyWizard.dance(); enemyWizard.castSpell(); }, beatInterval * 0.3); } // Activate rings randomly if (Math.random() < 0.4 && currentActiveRing < targetRings.length) { targetRings[currentActiveRing].activate(); // Auto-deactivate ring after some time if (ringActivationTimer) { LK.clearTimeout(ringActivationTimer); } ringActivationTimer = LK.setTimeout(function () { if (currentActiveRing < targetRings.length) { targetRings[currentActiveRing].deactivate(); currentActiveRing = (currentActiveRing + 1) % targetRings.length; } }, beatInterval * 2); } lastBeatTime = LK.ticks; }, beatInterval); // Handle button presses var buttonPressed = false; game.down = function (x, y, obj) { if (!gameActive) return; buttonPressed = false; // Check if any active button was pressed for (var i = 0; i < rhythmButtons.length; i++) { if (rhythmButtons[i].isActive) { var hit = rhythmButtons[i].down(x, y, obj); if (hit) { buttonPressed = true; // Calculate timing accuracy var timeSinceBeat = (LK.ticks - lastBeatTime) * (1000 / 60); // Convert to ms var accuracy = 1 - Math.min(timeSinceBeat / (beatInterval * 0.5), 1); if (accuracy > 0.3) { // Good timing playerWizard.dance(); playerWizard.castSpell(); var points = Math.floor(accuracy * 100); score += points * (combo + 1); combo++; LK.setScore(score); scoreText.setText('Score: ' + score); comboText.setText('Combo: ' + combo); } else { combo = 0; comboText.setText('Combo: 0'); } break; } } } // Check for O key press on active rings if (!buttonPressed) { for (var i = 0; i < targetRings.length; i++) { if (targetRings[i].isActive) { var ringHit = targetRings[i].down(x, y, obj); if (ringHit) { buttonPressed = true; currentActiveRing = (currentActiveRing + 1) % targetRings.length; break; } } } } if (!buttonPressed) { combo = 0; comboText.setText('Combo: 0'); } }; // Game update loop game.update = function () { if (!gameActive) return; // Update spells for (var i = spells.length - 1; i >= 0; i--) { var spell = spells[i]; // Check spell collision with wizards if (spell.direction > 0 && spell.intersects(enemyWizard)) { enemyWizard.takeDamage(10); spell.destroy(); spells.splice(i, 1); continue; } else if (spell.direction < 0 && spell.intersects(playerWizard)) { playerWizard.takeDamage(10); spell.destroy(); spells.splice(i, 1); continue; } // Remove spells that are off screen if (spell.x > 2200 || spell.x < -200) { spell.destroy(); spells.splice(i, 1); } } // Update health bars var playerHealthPercent = playerWizard.health / playerWizard.maxHealth; var enemyHealthPercent = enemyWizard.health / enemyWizard.maxHealth; playerHealthBar.scaleX = playerHealthPercent; enemyHealthBar.scaleX = enemyHealthPercent; // Check win/lose conditions if (playerWizard.health <= 0 && gameActive) { gameActive = false; LK.clearInterval(beatTimer); LK.setTimeout(function () { LK.showGameOver(); }, 1000); } else if (enemyWizard.health <= 0 && gameActive) { gameActive = false; LK.clearInterval(beatTimer); LK.setTimeout(function () { LK.showYouWin(); }, 1000); } // Auto-deactivate buttons if timing window passed var timeSinceBeat = (LK.ticks - lastBeatTime) * (1000 / 60); if (timeSinceBeat > beatInterval * 0.7) { for (var i = 0; i < rhythmButtons.length; i++) { if (rhythmButtons[i].isActive) { rhythmButtons[i].deactivate(); } } } };
===================================================================
--- original.js
+++ change.js
@@ -16,13 +16,13 @@
self.isActive = false;
self.originalScale = 1;
self.activate = function () {
self.isActive = true;
- // Move button from right side towards center
+ // Move button from right side to left side of screen
tween(self, {
- x: 1648 // Move towards enemy wizard position
+ x: -200 // Move to left side and exit screen
}, {
- duration: beatInterval * 0.8 // Move during most of the beat interval
+ duration: beatInterval * 1.5 // Move across entire screen
});
tween(buttonGraphics, {
scaleX: 1.2,
scaleY: 1.2
@@ -37,13 +37,9 @@
};
self.deactivate = function () {
self.isActive = false;
// Reset button position back to right side
- tween(self, {
- x: 2100
- }, {
- duration: 200
- });
+ self.x = 2100;
tween(buttonGraphics, {
scaleX: 1,
scaleY: 1
}, {
@@ -302,14 +298,14 @@
button.y = buttonY + i * buttonSpacing; // Stack vertically, one under the other
rhythmButtons.push(button);
game.addChild(button);
}
-// Create 4 target rings above left wizard
+// Create 4 target rings between wizard head and health bars
var targetRings = [];
for (var i = 0; i < 4; i++) {
var ring = new TargetRing();
ring.x = playerWizard.x;
- ring.y = playerWizard.y - 400 - i * 80; // Stack rings vertically
+ ring.y = 300 + i * 80; // Position between wizard head and health bars, stacked vertically
targetRings.push(ring);
game.addChild(ring);
}
// Variables for ring activation
a wizard with a red dress, a hat, a long white beard and his whole body. In-Game asset. 2d. High contrast. No shadows
A wizard with a blue dress (like a coat) holding a stick touching the ground and a colored stone on the end of the stick, a wizard with a white beard and a hat on his head, and his whole body and right arm should not be visible from the frame (screen). In-Game asset. 2d. High contrast. No shadows
Musical note. In-Game asset. 2d. High contrast. No shadows
a prismatic rotating cube with notes inside. In-Game asset. 2d. High contrast. No shadows