User prompt
player can only move between each column
User prompt
Fix Bug: 'TypeError: LK.effects.explode is not a function' in this line: 'LK.effects.explode(beat);' Line Number: 50
User prompt
If the player touch the beat, it explode
User prompt
make a bottom bar with 4 descriptions for each column being "Jab", "Arm Swing", "Chest Pop" and "Stomp"
User prompt
can you make the beat from each column different in colours
User prompt
Fix Bug: 'Uncaught ReferenceError: playerGraphics is not defined' in this line: 'player.y = 2732 - playerGraphics.height / 2;' Line Number: 19
User prompt
can you make the starting position of the player at the bottom of the screeen
User prompt
can you make the player only move horizontally
User prompt
reduce the beat to 4 columns
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'beats[a].move();' Line Number: 23
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'beats[a].move();' Line Number: 23
Initial prompt
KrumpBeatz DJ
var BeatColumn1 = Container.expand(function () { var self = Container.call(this); var beatGraphics = self.createAsset('beatColumn1', 'Beat Graphics Column 1', .5, .5); self.speed = 5; self.move = function () { self.y += self.speed; }; }); var BeatColumn2 = Container.expand(function () { var self = Container.call(this); var beatGraphics = self.createAsset('beatColumn2', 'Beat Graphics Column 2', .5, .5); self.speed = 5; self.move = function () { self.y += self.speed; }; }); var BeatColumn3 = Container.expand(function () { var self = Container.call(this); var beatGraphics = self.createAsset('beatColumn3', 'Beat Graphics Column 3', .5, .5); self.speed = 5; self.move = function () { self.y += self.speed; }; }); var BeatColumn4 = Container.expand(function () { var self = Container.call(this); var beatGraphics = self.createAsset('beatColumn4', 'Beat Graphics Column 4', .5, .5); self.speed = 5; self.move = function () { self.y += self.speed; }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5); self.dance = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var beats = []; var player = self.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - player.height / 2; LK.on('tick', function () { player.dance(); for (var a = beats.length - 1; a >= 0; a--) { var beat = beats[a]; beat.move(); if (player.intersects(beat)) { LK.effects.explode(beat); beat.destroy(); beats.splice(a, 1); } else if (beat.y > 2732) { beat.destroy(); beats.splice(a, 1); } } if (LK.ticks % 60 == 0) { var columnWidth = 2048 / 4; var columnIndex = Math.floor(Math.random() * 4); var newBeat; switch (columnIndex) { case 0: newBeat = new BeatColumn1(); break; case 1: newBeat = new BeatColumn2(); break; case 2: newBeat = new BeatColumn3(); break; case 3: newBeat = new BeatColumn4(); break; } newBeat.x = columnIndex * columnWidth + columnWidth / 2; newBeat.y = 0; beats.push(newBeat); self.addChild(newBeat); } }); stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); player.x = pos.x; }); });
===================================================================
--- original.js
+++ change.js
@@ -34,30 +34,10 @@
var self = Container.call(this);
var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5);
self.dance = function () {};
});
-var BottomBar = Container.expand(function () {
- var self = Container.call(this);
- var descriptions = ['Jab', 'Arm Swing', 'Chest Pop', 'Stomp'];
- var columnWidth = 2048 / 4;
- for (var i = 0; i < 4; i++) {
- var descriptionText = new Text2(descriptions[i], {
- size: 100,
- fill: "#ffffff",
- anchor: {
- x: 0.5,
- y: 0.5
- }
- });
- descriptionText.x = i * columnWidth + columnWidth / 2;
- descriptionText.y = 2732 - descriptionText.height / 2;
- self.addChild(descriptionText);
- }
-});
var Game = Container.expand(function () {
var self = Container.call(this);
- var bottomBar = self.addChild(new BottomBar());
- bottomBar.y = 2732 - 100;
var beats = [];
var player = self.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - player.height / 2;
@@ -65,11 +45,15 @@
player.dance();
for (var a = beats.length - 1; a >= 0; a--) {
var beat = beats[a];
beat.move();
- if (beat.y > 2732) {
+ if (player.intersects(beat)) {
+ LK.effects.explode(beat);
beat.destroy();
beats.splice(a, 1);
+ } else if (beat.y > 2732) {
+ beat.destroy();
+ beats.splice(a, 1);
}
}
if (LK.ticks % 60 == 0) {
var columnWidth = 2048 / 4;
a forward facing brick with the writing "Stomp" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a forward facing brick with the writing "Jab" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A Krump Dancer wearing a snapback and Timberlands shoes Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a forward facing brick with the writing "Chest Pop" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a forward facing brick with the writing "Arm Swing" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
an urban street road near a boom box Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a concrete floor Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.