User prompt
make the witch move all the way to the left or right of where the mouse clicks or the tap is
User prompt
make the witch move faster
User prompt
Allow the witch to move left or right with the arrow keys or mouse click or tapping on the screen
User prompt
Add red potion and orange potion. Red potion gives you an extra heart. Add a fireball icon that shows up under the hearts. Orange potion gives you a fireball that clears the screen of all onscreen rocks. Add a blue potion icon under the fireball icon. Blue potion gives you a shield that protects you from one hit from a rock. You lose the shield after one hit and you do not lose a heart
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')' in this line: 'window.addEventListener('keydown', function (event) {' Line Number: 55
User prompt
I still can't move the character with the arrow keys
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')' in this line: 'window.addEventListener('keydown', function (e) {' Line Number: 55
User prompt
move player left or right with the arrows keys
User prompt
add 3 hearts to the top left of the screen. Every time the witch is hit by a rock, you lose one heart. When you lose all 3 hearts, the game is over
User prompt
make potions spawn randomly every 5 seconds
User prompt
Add a background
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')' in this line: 'window.addEventListener('keydown', function (e) {' Line Number: 49
User prompt
Allow character to move left and right using arrow keys. And place character at the bottom of the screen
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'rocks[a].move();' Line Number: 55
Initial prompt
Witch Way? Potion Commotion
var BluePotion = Container.expand(function () { var self = Container.call(this); var bluePotionGraphics = self.createAsset('bluePotion', 'Shield Potion', .5, .5); self.speed = 3; self.move = function () { self.y += self.speed; }; }); var OrangePotion = Container.expand(function () { var self = Container.call(this); var orangePotionGraphics = self.createAsset('orangePotion', 'Fireball Potion', .5, .5); self.speed = 3; self.move = function () { self.y += self.speed; }; }); var RedPotion = Container.expand(function () { var self = Container.call(this); var redPotionGraphics = self.createAsset('redPotion', 'Extra Heart Potion', .5, .5); self.speed = 3; self.move = function () { self.y += self.speed; }; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.createAsset('heart', 'Player Life', .5, .5); }); var Rock = Container.expand(function () { var self = Container.call(this); var rockGraphics = self.createAsset('rock', 'Falling Rock', .5, .5); self.speed = 5; self.move = function () { self.y += self.speed; }; }); var Potion = Container.expand(function () { var self = Container.call(this); var potionGraphics = self.createAsset('potion', 'Boost Potion', .5, .5); self.speed = 3; self.move = function () { self.y += self.speed; }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player Character', .5, .5); self.shield = false; self.move = function (x, y) { self.x = x; self.y = y; }; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('background', 'Game Background', 0, 0); background.width = 2048; background.height = 2732; var rocks = []; var potions = []; var player = self.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - player.height; var lives = 3; var hearts = []; for (var i = 0; i < lives; i++) { var heart = new Heart(); heart.x = 50 + i * 100; heart.y = 50; hearts.push(heart); LK.gui.topLeft.addChild(heart); } var fireballIcon = self.createAsset('fireballIcon', 'Fireball Icon', .5, .5); fireballIcon.x = 50; fireballIcon.y = 150; LK.gui.topLeft.addChild(fireballIcon); var shieldIcon = self.createAsset('shieldIcon', 'Shield Icon', .5, .5); shieldIcon.x = 50; shieldIcon.y = 250; LK.gui.topLeft.addChild(shieldIcon); var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var dragNode = null; stage.on('keydown', function (event) { if (event.key == 'ArrowLeft') { player.move(player.x - 20, player.y); } else if (event.key == 'ArrowRight') { player.move(player.x + 20, player.y); } }); stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (pos.x < player.x) { player.move(0, player.y); } else if (pos.x > player.x) { player.move(2048, player.y); } }); function handleMove(obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (dragNode) { dragNode.move(pos.x, pos.y); } } LK.on('tick', function () { for (var a = rocks.length - 1; a >= 0; a--) { if (rocks[a]) { rocks[a].move(); if (rocks[a].y > 2732) { rocks[a].destroy(); rocks.splice(a, 1); } else if (player.intersects(rocks[a])) { rocks[a].destroy(); rocks.splice(a, 1); if (player.shield) { player.shield = false; } else { hearts[--lives].destroy(); hearts.splice(lives, 1); if (lives == 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } } } } for (var b = potions.length - 1; b >= 0; b--) { if (potions[b]) { potions[b].move(); if (potions[b].y > 2732) { potions[b].destroy(); potions.splice(b, 1); } else if (player.intersects(potions[b])) { if (potions[b] instanceof RedPotion) { var heart = new Heart(); heart.x = 50 + hearts.length * 100; heart.y = 50; hearts.push(heart); LK.gui.topLeft.addChild(heart); } else if (potions[b] instanceof OrangePotion) { for (var i = rocks.length - 1; i >= 0; i--) { rocks[i].destroy(); rocks.splice(i, 1); } } else if (potions[b] instanceof BluePotion) { player.shield = true; } potions[b].destroy(); potions.splice(b, 1); } } } if (LK.ticks % 60 == 0) { var newRock = new Rock(); newRock.x = Math.random() * 2048; newRock.y = 0; rocks.push(newRock); self.addChild(newRock); } if (LK.ticks % 300 == 0) { var newRedPotion = new RedPotion(); newRedPotion.x = Math.random() * 2048; newRedPotion.y = 0; potions.push(newRedPotion); self.addChild(newRedPotion); } if (LK.ticks % 450 == 0) { var newOrangePotion = new OrangePotion(); newOrangePotion.x = Math.random() * 2048; newOrangePotion.y = 0; potions.push(newOrangePotion); self.addChild(newOrangePotion); } if (LK.ticks % 600 == 0) { var newBluePotion = new BluePotion(); newBluePotion.x = Math.random() * 2048; newBluePotion.y = 0; potions.push(newBluePotion); self.addChild(newBluePotion); } }); });
===================================================================
--- original.js
+++ change.js
@@ -95,11 +95,11 @@
stage.on('down', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
if (pos.x < player.x) {
- player.move(player.x - 20, player.y);
+ player.move(0, player.y);
} else if (pos.x > player.x) {
- player.move(player.x + 20, player.y);
+ player.move(2048, player.y);
}
});
function handleMove(obj) {
var event = obj.event;
Witch Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Witch Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Rock A big rock
blue potion a blue potion
A witch's room with a cauldron A witch's room with a cauldron
heart icon heart icon
fireball icon fireball icon, no background
blue shield blue shield no background
red potion red potion, no background
orange potion orange potion, no background
START button START button