Code edit (2 edits merged)
Please save this source code
User prompt
On square down, tween all particles to a new random location
Code edit (1 edits merged)
Please save this source code
User prompt
Add 100 particles to the game
Code edit (4 edits merged)
Please save this source code
User prompt
Add a particle class to the game as well
Code edit (1 edits merged)
Please save this source code
User prompt
Also set Tint in between.
User prompt
Use a Bouncy Tween animation.
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(self, {' Line Number: 16 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var tween = LK.import("@upit/tween.v1");' Line Number: 9
User prompt
When clicking the square, animate it to be 10 times the size. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var tween = LK.import("@upit/tween.v1");' Line Number: 9
User prompt
Add a square to the game
Initial prompt
Empty test game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Particle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); }); var Square = Container.expand(function () { var self = Container.call(this); var squareGraphics = self.attachAsset('square', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { tween(self, { scaleX: Math.random() * 10 + 1, scaleY: Math.random() * 10 + 1, tint: [0xffffff, 0xff0000, 0x00ff00, 0xffff00, 0x00ffff, 0xff00ff][6 * Math.random() >> 0] }, { duration: 1000, easing: tween.bounceOut }); game.children.forEach(function (child) { if (child instanceof Particle) { tween(child, { x: Math.random() * 2048, y: Math.random() * 2732 }, { duration: 1000, easing: tween.bounceIn }); } }); }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ for (var i = 0; i < 100; i++) { var particle = game.addChild(new Particle()); particle.x = Math.random() * 2048; particle.y = Math.random() * 2732; } var square = game.addChild(new Square()); square.x = 1024; square.y = 1366;
===================================================================
--- original.js
+++ change.js
@@ -34,9 +34,9 @@
x: Math.random() * 2048,
y: Math.random() * 2732
}, {
duration: 1000,
- easing: tween.bounceOut
+ easing: tween.bounceIn
});
}
});
};