User prompt
hilangkan touchpad kontrol dan rubah ke mode kontrol gulir
User prompt
pindahkan tombol touch pad shoot ke kanan bawah layar
User prompt
fix suara music
User prompt
add background asset
User prompt
shoot interval 2 second
User prompt
fix shoot respo
User prompt
make the distance greater between the control pad and the shooting pad
User prompt
move control touchpad to lefft
User prompt
move shoot touch pad to right side bank
User prompt
delete player interval for shoot
User prompt
move shoot button to right side
User prompt
add touch pad for player shoot
User prompt
player bullet interval 1 second
User prompt
playe bullet interval 2 second
User prompt
enemy bullet inter chanhe to 2 second
User prompt
enemy bullet interval 0,5 second
User prompt
delete charge attack
User prompt
rockmonster dificult to defeat
User prompt
make touch pad for control player
User prompt
fix control
Code edit (1 edits merged)
Please save this source code
User prompt
Magic Adventurer vs Rock Monster
Initial prompt
magic adventurer vs rock monster. hold to control player
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Adventurer = Container.expand(function () { var self = Container.call(this); var adventurerGraphics = self.attachAsset('adventurer', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 100; self.health = self.maxHealth; self.chargeTime = 0; self.maxChargeTime = 120; self.magicCharge = null; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.health = 0; LK.showGameOver(); } LK.effects.flashObject(self, 0xFF0000, 500); }; self.startCharging = function () { self.chargeTime = 0; self.magicCharge = game.addChild(new MagicCharge()); self.magicCharge.x = self.x; self.magicCharge.y = self.y - 50; magicCharges.push(self.magicCharge); }; self.stopCharging = function () { if (self.magicCharge) { var chargeLevel = Math.min(self.chargeTime / self.maxChargeTime, 1); self.castSpell(chargeLevel); var chargeIndex = magicCharges.indexOf(self.magicCharge); if (chargeIndex !== -1) { self.magicCharge.destroy(); magicCharges.splice(chargeIndex, 1); } self.magicCharge = null; } self.chargeTime = 0; }; self.castSpell = function (chargeLevel) { var numBolts = Math.floor(1 + chargeLevel * 4); var baseDamage = 8 + chargeLevel * 12; for (var i = 0; i < numBolts; i++) { var bolt = game.addChild(new MagicBolt()); bolt.x = self.x + (i - numBolts / 2) * 30; bolt.y = self.y - 30; bolt.damage = baseDamage; magicBolts.push(bolt); } LK.getSound('magicCast').play(); LK.effects.flashObject(self, 0xFFD700, 300); }; return self; }); var MagicBolt = Container.expand(function () { var self = Container.call(this); var boltGraphics = self.attachAsset('magicBolt', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.damage = 10; self.update = function () { self.y -= self.speed; }; return self; }); var MagicCharge = Container.expand(function () { var self = Container.call(this); var chargeGraphics = self.attachAsset('magicCharge', { anchorX: 0.5, anchorY: 0.5 }); self.maxSize = 80; self.growRate = 2; self.update = function () { if (self.scaleX < self.maxSize / 40) { self.scaleX += self.growRate * 0.02; self.scaleY += self.growRate * 0.02; } self.rotation += 0.1; self.alpha = 0.7 + Math.sin(LK.ticks * 0.3) * 0.3; }; return self; }); var MonsterAttack = Container.expand(function () { var self = Container.call(this); var attackGraphics = self.attachAsset('monsterAttack', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; self.damage = 35; self.update = function () { self.y += self.speed; self.rotation += 0.2; }; return self; }); var RockMonster = Container.expand(function () { var self = Container.call(this); var monsterGraphics = self.attachAsset('rockMonster', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 500; self.health = self.maxHealth; self.attackTimer = 0; self.attackCooldown = 60; self.moveDirection = 1; self.moveSpeed = 2; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.health = 0; LK.showYouWin(); } LK.effects.flashObject(self, 0xFF0000, 400); LK.getSound('monsterHit').play(); }; self.attack = function () { var attack = game.addChild(new MonsterAttack()); attack.x = self.x; attack.y = self.y + 120; monsterAttacks.push(attack); }; self.update = function () { // Move side to side self.x += self.moveDirection * self.moveSpeed; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } // Attack timer self.attackTimer++; if (self.attackTimer >= self.attackCooldown) { self.attack(); self.attackTimer = 0; } }; return self; }); var Touchpad = Container.expand(function () { var self = Container.call(this); var baseGraphics = self.attachAsset('touchpadBase', { anchorX: 0.5, anchorY: 0.5 }); var knobGraphics = self.attachAsset('touchpadKnob', { anchorX: 0.5, anchorY: 0.5 }); self.knob = knobGraphics; self.maxDistance = 35; self.isActive = false; self.inputX = 0; self.inputY = 0; baseGraphics.alpha = 0.6; knobGraphics.alpha = 0.8; self.updateKnob = function (x, y) { var dx = x - self.x; var dy = y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance <= self.maxDistance) { self.knob.x = dx; self.knob.y = dy; } else { var angle = Math.atan2(dy, dx); self.knob.x = Math.cos(angle) * self.maxDistance; self.knob.y = Math.sin(angle) * self.maxDistance; } self.inputX = self.knob.x / self.maxDistance; self.inputY = self.knob.y / self.maxDistance; }; self.resetKnob = function () { self.knob.x = 0; self.knob.y = 0; self.inputX = 0; self.inputY = 0; self.isActive = false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C3E50 }); /**** * Game Code ****/ var adventurer = game.addChild(new Adventurer()); adventurer.x = 1024; adventurer.y = 2200; var rockMonster = game.addChild(new RockMonster()); rockMonster.x = 1024; rockMonster.y = 400; var magicBolts = []; var magicCharges = []; var monsterAttacks = []; var isCharging = false; var dragNode = null; var touchpad = game.addChild(new Touchpad()); touchpad.x = 200; touchpad.y = 2500; var touchpadActive = false; // Health bars var adventurerHealthBar = new Text2('Health: 100', { size: 60, fill: 0x00FF00 }); adventurerHealthBar.anchor.set(0, 0); LK.gui.bottomLeft.addChild(adventurerHealthBar); var monsterHealthBar = new Text2('Monster: 500', { size: 60, fill: 0xFF0000 }); monsterHealthBar.anchor.set(0.5, 0); LK.gui.top.addChild(monsterHealthBar); function handleMove(x, y, obj) { if (touchpadActive) { touchpad.updateKnob(x, y); } } game.move = handleMove; game.down = function (x, y, obj) { // Check if touching touchpad area var dx = x - touchpad.x; var dy = y - touchpad.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance <= 80) { touchpadActive = true; touchpad.isActive = true; touchpad.updateKnob(x, y); } else { // Start charging magic if not on touchpad isCharging = true; adventurer.startCharging(); } }; game.up = function (x, y, obj) { if (touchpadActive) { touchpad.resetKnob(); touchpadActive = false; } if (isCharging) { adventurer.stopCharging(); isCharging = false; } }; game.update = function () { // Update adventurer movement with touchpad if (touchpad.isActive) { var moveSpeed = 6; var newX = adventurer.x + touchpad.inputX * moveSpeed; var newY = adventurer.y + touchpad.inputY * moveSpeed; adventurer.x = Math.max(40, Math.min(2008, newX)); adventurer.y = Math.max(1500, Math.min(2680, newY)); // Update magic charge position if (adventurer.magicCharge) { adventurer.magicCharge.x = adventurer.x; adventurer.magicCharge.y = adventurer.y - 50; } } // Update charging if (isCharging) { adventurer.chargeTime++; } // Update magic bolts for (var i = magicBolts.length - 1; i >= 0; i--) { var bolt = magicBolts[i]; if (bolt.y < -50) { bolt.destroy(); magicBolts.splice(i, 1); continue; } if (bolt.intersects(rockMonster)) { rockMonster.takeDamage(bolt.damage); bolt.destroy(); magicBolts.splice(i, 1); } } // Update monster attacks for (var i = monsterAttacks.length - 1; i >= 0; i--) { var attack = monsterAttacks[i]; if (attack.y > 2800) { attack.destroy(); monsterAttacks.splice(i, 1); continue; } if (attack.intersects(adventurer)) { adventurer.takeDamage(attack.damage); LK.getSound('playerHit').play(); attack.destroy(); monsterAttacks.splice(i, 1); } } // Update health displays adventurerHealthBar.setText('Health: ' + adventurer.health); monsterHealthBar.setText('Monster: ' + rockMonster.health); };
===================================================================
--- original.js
+++ change.js
@@ -46,9 +46,9 @@
self.chargeTime = 0;
};
self.castSpell = function (chargeLevel) {
var numBolts = Math.floor(1 + chargeLevel * 4);
- var baseDamage = 15 + chargeLevel * 20;
+ var baseDamage = 8 + chargeLevel * 12;
for (var i = 0; i < numBolts; i++) {
var bolt = game.addChild(new MagicBolt());
bolt.x = self.x + (i - numBolts / 2) * 30;
bolt.y = self.y - 30;
@@ -97,9 +97,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 4;
- self.damage = 25;
+ self.damage = 35;
self.update = function () {
self.y += self.speed;
self.rotation += 0.2;
};
@@ -110,12 +110,12 @@
var monsterGraphics = self.attachAsset('rockMonster', {
anchorX: 0.5,
anchorY: 0.5
});
- self.maxHealth = 200;
+ self.maxHealth = 500;
self.health = self.maxHealth;
self.attackTimer = 0;
- self.attackCooldown = 90;
+ self.attackCooldown = 60;
self.moveDirection = 1;
self.moveSpeed = 2;
self.takeDamage = function (damage) {
self.health -= damage;
@@ -220,9 +220,9 @@
fill: 0x00FF00
});
adventurerHealthBar.anchor.set(0, 0);
LK.gui.bottomLeft.addChild(adventurerHealthBar);
-var monsterHealthBar = new Text2('Monster: 200', {
+var monsterHealthBar = new Text2('Monster: 500', {
size: 60,
fill: 0xFF0000
});
monsterHealthBar.anchor.set(0.5, 0);
litle girl ride flyng broom stick. In-Game asset. 2d. High contrast. No shadows
evil black gray cloud monster. In-Game asset. 2d. High contrast. No shadows
black dark lighting orb ball In-Game asset. 2d. High contrast. No shadows
langit biru cerah, daerah hutan luas, di kejauhan ada pedesaaan sederhana. suasana pagi hari langit biru. In-Game asset. 2d. High contrast. No shadows