Code edit (1 edits merged)
Please save this source code
User prompt
Add a character to the game
Code edit (6 edits merged)
Please save this source code
User prompt
include the tween plugin and nothing else ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'container is not a function. (In 'container(new Platform(width))', 'container' is an instance of Object)' in or related to this line: 'platformGraphics = width;' Line Number: 32
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Add a platform class to the game
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: bridge' in or related to this line: 'bridge.width = facekit.pitch;' Line Number: 37
User prompt
Add the facekit api ↪💡 Consider importing and using the following plugins: @upit/facekit.v1
Code edit (1 edits merged)
Please save this source code
Initial prompt
Pitch Bridges
/****
* Plugins
****/
var facekit = LK.import("@upit/facekit.v1");
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Bridge class to represent the bridge being built
var Bridge = Container.expand(function () {
var self = Container.call(this);
var bridgeGraphics = self.attachAsset('bridge', {
anchorX: .5,
anchorY: 1
});
// Method to update the bridge's width based on voice pitch
});
// Platform class to represent the platform in the game
var Platform = Container.expand(function (width) {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0
});
self.height = 500;
platformGraphics = width;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
var container = game.addChild(new Container());
var platforms = [];
function addPlatform(x, width) {
var platform = container.addChild(new Platform(width));
platform.y = 2400;
platform.x = x;
platform.width = width;
}
addPlatform(200, 500);
addPlatform(700, 100);
addPlatform(1200, 300);
addPlatform(1700, 300);
var bridge = game.addChild(new Bridge());
bridge.y = 2400;
bridge.x = 200;
var mouseIsDown = false;
game.update = function () {
if (mouseIsDown) {
bridge.height += 3;
}
};
game.down = function () {
if (!mouseIsDown) {
mouseIsDown = true;
}
};
game.up = function () {
if (mouseIsDown) {
console.log("here");
mouseIsDown = false;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,18 +1,19 @@
/****
* Plugins
****/
var facekit = LK.import("@upit/facekit.v1");
+var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Bridge class to represent the bridge being built
var Bridge = Container.expand(function () {
var self = Container.call(this);
var bridgeGraphics = self.attachAsset('bridge', {
- anchorX: 0,
- anchorY: 0.5
+ anchorX: .5,
+ anchorY: 1
});
// Method to update the bridge's width based on voice pitch
});
// Platform class to represent the platform in the game
@@ -49,5 +50,22 @@
addPlatform(1200, 300);
addPlatform(1700, 300);
var bridge = game.addChild(new Bridge());
bridge.y = 2400;
-bridge.x = 200;
\ No newline at end of file
+bridge.x = 200;
+var mouseIsDown = false;
+game.update = function () {
+ if (mouseIsDown) {
+ bridge.height += 3;
+ }
+};
+game.down = function () {
+ if (!mouseIsDown) {
+ mouseIsDown = true;
+ }
+};
+game.up = function () {
+ if (mouseIsDown) {
+ console.log("here");
+ mouseIsDown = false;
+ }
+};
\ No newline at end of file
White gameplay character, black outline. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
White ribbon banner with text "Hit this pitch with your voice". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Fast white up arrow. Simple design. Black background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows