User prompt
remove on keydown listener
User prompt
convert from isometric to standard grid for ice blocks
User prompt
still no arrow key movement?
User prompt
turn this into a pacman style game
User prompt
limit player rotation to either 1 or -1
User prompt
clamp player rotation to 1 and -1
User prompt
on click anywhere, flip player character to face that iretion
User prompt
revert
User prompt
do you know any maze-creation algorithms suitable for isometric worlds?
User prompt
isometric world whould account for 200 pixels wide tiles
User prompt
nobody puts pengiun in the corner
User prompt
center game world in window
User prompt
show whole game world inside window
User prompt
make iceblock placemtn 100% guaranteed along edges
User prompt
i meants 10 percent, except for edges
User prompt
only place iceblocks in 20% of current cases
User prompt
switch to isometric game world
User prompt
can you print console.log messages in this area?
User prompt
explain where does conole.log show up in this engine?
User prompt
show console.log
User prompt
is lk.onkeydown working?
User prompt
Fix Bug: 'Uncaught TypeError: window.addEventListener is not a function' in this line: 'window.addEventListener('keydown', function (e) {' Line Number: 81
User prompt
add player movement up, down, left, right based on arrow kayes and WASD keys
User prompt
remove all player movement code
User prompt
why doesn't penguin move?
var IceBlock = Container.expand(function () { console.log('IceBlock class initialized'); var self = Container.call(this); console.log('Container called'); var iceBlockGraphics = self.createAsset('iceBlock', 'Ice Block', .5, .5); console.log('IceBlock asset created'); self.destroyBlock = function () { console.log('Ice block destroyed:', self); self.destroy(); console.log('IceBlock destroyed'); }; }); var Player = Container.expand(function () { console.log('Player class initialized'); var self = Container.call(this); console.log('Container called'); var playerGraphics = self.createAsset('player', 'Player character', .5, .5); console.log('Player asset created'); self.shoot = function () {}; console.log('Shoot function added'); }); var Bullet = Container.expand(function () { console.log('Bullet class initialized'); var self = Container.call(this); console.log('Container called'); var bulletGraphics = self.createAsset('bullet', 'Bullet', .5, .5); console.log('Bullet asset created'); self.move = function () {}; console.log('Move function added'); }); var Enemy = Container.expand(function () { console.log('Enemy class initialized'); var self = Container.call(this); console.log('Container called'); var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5); console.log('Enemy asset created'); self.move = function () {}; console.log('Move function added'); }); var Game = Container.expand(function () { console.log('Game class initialized'); var self = Container.call(this); console.log('Container called'); var player = self.addChild(new Player()); console.log('Player added'); var bullets = []; console.log('Bullets array created'); var enemies = []; console.log('Enemies array created'); player.x = (LK.stageContainer.width - player.width) / 2 + 100; player.y = (LK.stageContainer.height - player.height) / 2 + 100; console.log('Player positioned away from the corner'); var iceBlocks = []; var blockSize = 200; for (var i = 0; i < 20; i++) { for (var j = 0; j < 20; j++) { if (i === 0 || i === 19 || j === 0 || j === 19) { var iceBlock = new IceBlock(); iceBlock.x = i * blockSize; iceBlock.y = j * blockSize; iceBlocks.push(iceBlock); self.addChild(iceBlock); } } } LK.on('tick', function () { for (var i = 0; i < bullets.length; i++) { bullets[i].move(); } for (var i = 0; i < enemies.length; i++) { enemies[i].move(); } for (var i = 0; i < bullets.length; i++) { for (var j = 0; j < iceBlocks.length; j++) { if (bullets[i].intersects(iceBlocks[j])) { iceBlocks[j].destroyBlock(); iceBlocks.splice(j, 1); bullets[i].destroy(); bullets.splice(i, 1); break; } } } }); player.on('down', function (obj) { var bullet = new Bullet(); console.log('Bullet created:', bullet); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); self.addChild(bullet); }); LK.on('keydown', function (e) { console.log('Key pressed: ', e.key); switch (e.key) { case 'ArrowUp': case 'w': player.x += 10; player.y -= 5; break; case 'ArrowDown': case 's': player.x -= 10; player.y += 5; break; case 'ArrowLeft': case 'a': player.x -= 10; player.y -= 5; console.log('Player position:', player.x, player.y); break; case 'ArrowRight': case 'd': player.x += 10; player.y += 5; break; default: break; } }); });
===================================================================
--- original.js
+++ change.js
@@ -1,111 +1,119 @@
-var Dot = Container.expand(function () {
- console.log('Dot class initialized');
+var IceBlock = Container.expand(function () {
+ console.log('IceBlock class initialized');
var self = Container.call(this);
console.log('Container called');
- var dotGraphics = self.createAsset('dot', 'Dot', .5, .5);
- console.log('Dot asset created');
- self.eatDot = function () {
- console.log('Dot eaten:', self);
+ var iceBlockGraphics = self.createAsset('iceBlock', 'Ice Block', .5, .5);
+ console.log('IceBlock asset created');
+ self.destroyBlock = function () {
+ console.log('Ice block destroyed:', self);
self.destroy();
- console.log('Dot destroyed');
+ console.log('IceBlock destroyed');
};
});
-var Pacman = Container.expand(function () {
- console.log('Pacman class initialized');
+var Player = Container.expand(function () {
+ console.log('Player class initialized');
var self = Container.call(this);
console.log('Container called');
- var pacmanGraphics = self.createAsset('pacman', 'Pacman character', .5, .5);
- console.log('Pacman asset created');
- self.move = function () {};
- console.log('Move function added');
+ var playerGraphics = self.createAsset('player', 'Player character', .5, .5);
+ console.log('Player asset created');
+ self.shoot = function () {};
+ console.log('Shoot function added');
});
-var Ghost = Container.expand(function () {
- console.log('Ghost class initialized');
+var Bullet = Container.expand(function () {
+ console.log('Bullet class initialized');
var self = Container.call(this);
console.log('Container called');
- var ghostGraphics = self.createAsset('ghost', 'Ghost', .5, .5);
- console.log('Ghost asset created');
+ var bulletGraphics = self.createAsset('bullet', 'Bullet', .5, .5);
+ console.log('Bullet asset created');
self.move = function () {};
console.log('Move function added');
});
-var PowerPellet = Container.expand(function () {
- console.log('PowerPellet class initialized');
+var Enemy = Container.expand(function () {
+ console.log('Enemy class initialized');
var self = Container.call(this);
console.log('Container called');
- var powerPelletGraphics = self.createAsset('powerPellet', 'Power Pellet', .5, .5);
- console.log('PowerPellet asset created');
- self.eatPowerPellet = function () {
- console.log('Power Pellet eaten:', self);
- self.destroy();
- console.log('PowerPellet destroyed');
- };
+ var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5);
+ console.log('Enemy asset created');
+ self.move = function () {};
+ console.log('Move function added');
});
var Game = Container.expand(function () {
console.log('Game class initialized');
var self = Container.call(this);
console.log('Container called');
- var pacman = self.addChild(new Pacman());
- console.log('Pacman added');
- var ghosts = [];
- console.log('Ghosts array created');
- var powerPellets = [];
- console.log('PowerPellets array created');
- pacman.x = (LK.stageContainer.width - pacman.width) / 2 + 100;
- pacman.y = (LK.stageContainer.height - pacman.height) / 2 + 100;
- console.log('Pacman positioned away from the corner');
- var dots = [];
+ var player = self.addChild(new Player());
+ console.log('Player added');
+ var bullets = [];
+ console.log('Bullets array created');
+ var enemies = [];
+ console.log('Enemies array created');
+ player.x = (LK.stageContainer.width - player.width) / 2 + 100;
+ player.y = (LK.stageContainer.height - player.height) / 2 + 100;
+ console.log('Player positioned away from the corner');
+ var iceBlocks = [];
var blockSize = 200;
for (var i = 0; i < 20; i++) {
for (var j = 0; j < 20; j++) {
if (i === 0 || i === 19 || j === 0 || j === 19) {
- var dot = new Dot();
- dot.x = (i - j) * blockSize / 2 + LK.stageContainer.width / 2;
- dot.y = (i + j) * blockSize / 4;
- dots.push(dot);
- self.addChild(dot);
+ var iceBlock = new IceBlock();
+ iceBlock.x = i * blockSize;
+ iceBlock.y = j * blockSize;
+ iceBlocks.push(iceBlock);
+ self.addChild(iceBlock);
}
}
}
LK.on('tick', function () {
- for (var i = 0; i < ghosts.length; i++) {
- ghosts[i].move();
+ for (var i = 0; i < bullets.length; i++) {
+ bullets[i].move();
}
- for (var i = 0; i < dots.length; i++) {
- if (pacman.intersects(dots[i])) {
- dots[i].eatDot();
- dots.splice(i, 1);
- break;
+ for (var i = 0; i < enemies.length; i++) {
+ enemies[i].move();
+ }
+ for (var i = 0; i < bullets.length; i++) {
+ for (var j = 0; j < iceBlocks.length; j++) {
+ if (bullets[i].intersects(iceBlocks[j])) {
+ iceBlocks[j].destroyBlock();
+ iceBlocks.splice(j, 1);
+ bullets[i].destroy();
+ bullets.splice(i, 1);
+ break;
+ }
}
}
});
- pacman.on('down', function (obj) {
- var ghost = new Ghost();
- console.log('Ghost created:', ghost);
- ghost.x = pacman.x;
- ghost.y = pacman.y;
- ghosts.push(ghost);
- self.addChild(ghost);
+ player.on('down', function (obj) {
+ var bullet = new Bullet();
+ console.log('Bullet created:', bullet);
+ bullet.x = player.x;
+ bullet.y = player.y;
+ bullets.push(bullet);
+ self.addChild(bullet);
});
LK.on('keydown', function (e) {
console.log('Key pressed: ', e.key);
switch (e.key) {
case 'ArrowUp':
case 'w':
- pacman.y -= 10;
+ player.x += 10;
+ player.y -= 5;
break;
case 'ArrowDown':
case 's':
- pacman.y += 10;
+ player.x -= 10;
+ player.y += 5;
break;
case 'ArrowLeft':
case 'a':
- pacman.x -= 10;
- console.log('Pacman position:', pacman.x, pacman.y);
+ player.x -= 10;
+ player.y -= 5;
+ console.log('Player position:', player.x, player.y);
break;
case 'ArrowRight':
case 'd':
- pacman.x += 10;
+ player.x += 10;
+ player.y += 5;
break;
default:
break;
}
a penguin engineer Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
rectangular ice wall section, top down view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
ice floor texture tile top down view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
one cartoony snowball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white dot. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
button with arrow key pointing left. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a large round playbutton Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoony evil snowman character Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
icy treasure chest Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A snowcovered christmas tree decorated with snowballs.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.