User prompt
increase resolution of the background
User prompt
add a background
User prompt
the balls should have different assets.
Code edit (1 edits merged)
Please save this source code
User prompt
the balls sprites should rotate themself to watch the other ball.
Code edit (3 edits merged)
Please save this source code
User prompt
the rotating ball angle, should increase with time/
Code edit (1 edits merged)
Please save this source code
User prompt
when switching rotation between the 2 balls, the newly rotating ball should compute it's new angle to match is current position.
User prompt
balls should have an angle value which is used for the rotation
Code edit (1 edits merged)
Please save this source code
User prompt
when switching rotation between the 2 balls, the balls should keep the same position.
Code edit (1 edits merged)
Please save this source code
User prompt
create a class Ball which have a rotating status. And use this class for the player balls.
User prompt
when the user click, the rotating ball stop to rotate, and the other one start rotating around the first one.
Code edit (2 edits merged)
Please save this source code
User prompt
increase the gap between the balls
User prompt
the first ball should rotate around the second one
User prompt
there is a little gap between the 2 balls. twice the with of the balls
User prompt
player is composed by the 2 balls
User prompt
create two ball assets
Code edit (1 edits merged)
Please save this source code
Initial prompt
adofai
===================================================================
--- original.js
+++ change.js
@@ -8,14 +8,8 @@
self.attachAsset('playerBall1', {
anchorX: 0.5,
anchorY: 0.5
});
- self.rotate = function () {
- if (self.rotating) {
- self.angle += 0.05;
- self.rotation = self.angle;
- }
- };
});
var Player = Container.expand(function () {
var self = Container.call(this);
var ball1 = self.addChild(new Ball());
@@ -35,10 +29,17 @@
ball2.angle = Math.atan2(ball2.y - ball1.y, ball2.x - ball1.x);
}
};
self.rotate = function () {
- ball1.rotate();
- ball2.rotate();
+ if (ball1.rotating) {
+ ball1.rotation = ball1.angle += 0.05;
+ ball1.x = ball2.x + ball2.width * 2 * Math.cos(ball1.angle);
+ ball1.y = ball2.y + ball2.width * 2 * Math.sin(ball1.angle);
+ } else if (ball2.rotating) {
+ ball2.angle += 0.05;
+ ball2.x = ball1.x + ball1.width * 2 * Math.cos(ball2.angle);
+ ball2.y = ball1.y + ball1.width * 2 * Math.sin(ball2.angle);
+ }
};
});
/****
@@ -50,11 +51,11 @@
/****
* Game Code
****/
-// Initialize background stars
-// Initialize obstacle asset
// Initialize player ship asset
+// Initialize obstacle asset
+// Initialize background stars
var player = game.addChild(new Player());
player.x = 1024; // Center horizontally
player.y = 2400; // Position towards the bottom
game.on('down', function (obj) {
tête de mort rouge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tête de mort coter droit en bleu coter gauche en rouge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tourbillon bleu et rouge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bone. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tourbillon rouge et bleu. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.