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 () { var self = Container.call(this); var iceBlockGraphics = self.createAsset('iceBlock', 'Ice Block', .5, .5); self.destroyBlock = function () { self.destroy(); }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player character', .5, .5); self.shoot = function () {}; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('bullet', 'Bullet', .5, .5); self.move = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5); self.move = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var player = self.addChild(new Player()); var bullets = []; var enemies = []; player.x = 2048 / 2; player.y = 2732 / 2; var iceBlocks = []; for (var i = 0; i < 20; i++) { var topIceBlock = new IceBlock(); topIceBlock.x = i * 200; topIceBlock.y = 0; iceBlocks.push(topIceBlock); self.addChild(topIceBlock); var bottomIceBlock = new IceBlock(); bottomIceBlock.x = i * 200; bottomIceBlock.y = 2732 - bottomIceBlock.height; iceBlocks.push(bottomIceBlock); self.addChild(bottomIceBlock); } for (var j = 1; j < 13; j++) { var leftIceBlock = new IceBlock(); leftIceBlock.x = 0; leftIceBlock.y = j * 200; iceBlocks.push(leftIceBlock); self.addChild(leftIceBlock); var rightIceBlock = new IceBlock(); rightIceBlock.x = 2048 - rightIceBlock.width; rightIceBlock.y = j * 200; iceBlocks.push(rightIceBlock); self.addChild(rightIceBlock); } 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(); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); self.addChild(bullet); }); window.addEventListener('keydown', function (e) { switch (e.key) { case 'ArrowUp': case 'w': player.y -= 10; break; case 'ArrowDown': case 's': player.y += 10; break; case 'ArrowLeft': case 'a': player.x -= 10; break; case 'ArrowRight': case 'd': player.x += 10; break; default: break; } }); });
===================================================================
--- original.js
+++ change.js
@@ -77,20 +77,27 @@
bullet.y = player.y;
bullets.push(bullet);
self.addChild(bullet);
});
- var dragNode = null;
- stage.on('down', function (obj) {
- dragNode = player;
- });
- stage.on('move', function (obj) {
- var event = obj.event;
- var pos = event.getLocalPosition(self);
- if (dragNode) {
- dragNode.x = pos.x;
- dragNode.y = pos.y;
+ window.addEventListener('keydown', function (e) {
+ switch (e.key) {
+ case 'ArrowUp':
+ case 'w':
+ player.y -= 10;
+ break;
+ case 'ArrowDown':
+ case 's':
+ player.y += 10;
+ break;
+ case 'ArrowLeft':
+ case 'a':
+ player.x -= 10;
+ break;
+ case 'ArrowRight':
+ case 'd':
+ player.x += 10;
+ break;
+ default:
+ break;
}
});
- stage.on('up', function (obj) {
- dragNode = null;
- });
});
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.