Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
please write that function as a standalone function to be called from within the star's current move function
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: center is not defined' in or related to this line: 'var instructionsTxt = new Text2('Welcome to space, traveler!\nTap to collect the color indicated below.', {' Line Number: 426
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: The supplied index is out of bounds' in or related to this line: 'game.setChildIndex(counter, game.children.length);' Line Number: 249
Code edit (9 edits merged)
Please save this source code
User prompt
can you update this line, so it updates the textlabel with the new value
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: sel is not defined' in or related to this line: 'self.x = sel.x;' Line Number: 24
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: particleGraphics is not defined' in or related to this line: 'if (particleGraphics.alpha <= 0) {' Line Number: 247
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
please implement it that way
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: movetype is not defined' in or related to this line: 'if (movetype == 0) {' Line Number: 119
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,24 @@
/****
* Classes
****/
+var Counter = Container.expand(function () {
+ var self = Container.call(this);
+ var txt = new Text2('10', {
+ size: 100,
+ fill: "#ffffff",
+ anchorX: 0.5,
+ anchorY: 0
+ });
+ self.addChild(txt);
+ self.init = function (index) {
+ //var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+ //self.width = game.width / (currentPalette.length - 1) / 2;
+ //self.height = self.width / 2;
+ self.x = selector.x;
+ self.y = game.height - 120;
+ };
+});
// Particle class for explosion effect
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('star', {
@@ -28,9 +45,10 @@
/*
TODOS:
======
- Determine game over conditions
-* Time based per palette (based on number of colors in it)?
+* Time based per palette (based on number of colors in it)? Yes, place a countdown timer on the active palette color.
+ If it reaches 0 before that color has been clicked, game over.
* Number of misclicks?
- Write instructions on game start.
- Game gets visually exhausting after some time. Maybe there should be a status screen once in a while, just to break it up?
- Maybe, once a color has been clicked/tapped, stars should stop spawning in that color for remainder of the level?
@@ -46,8 +64,16 @@
var selectorGraphics = self.attachAsset('selector', {
anchorX: 0,
anchorY: 0
});
+ /*
+ var counter = new Text2('10', {
+ size: 100,
+ fill: "#ffffff",
+ anchorX: 0.5,
+ anchorY: 0
+ });
+ self.addChild(counter);*/
self.init = function (index) {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
self.width = game.width / (currentPalette.length - 1) / 2;
self.height = self.width / 2;
@@ -147,9 +173,9 @@
self.y = centerY + Math.cos(self.z / 10000) * self.vy * self.z;
} else {
self.y = centerY + self.vy * self.z;
}*/
- var moveType = 5; //allPalettesCounter % 4;
+ var moveType = allPalettesCounter % 4;
if (moveType == 0) {
self.x = centerX + self.vx * self.z;
self.y = centerY + self.vy * self.z;
} else if (moveType == 1) {
@@ -161,12 +187,13 @@
} else if (moveType == 3) {
self.x = centerX + Math.sin(self.z / 10000) * self.vx * self.z;
self.y = centerY + Math.cos(self.z / 10000) * self.vy * self.z;
} else {
- self.x += Math.cos(LK.ticks % 100);
+ self.x = centerX + self.vx * self.z;
+ //self.x += Math.cos(LK.ticks % 100) * 10;
self.y -= 4;
}
- if (false) {
+ if (!false) {
// Scale star based on z position to simulate 3D effect
var scale = Math.min(1000 / (1000 + self.z), 1.5); // Limit maximum scale to 1.5 to prevent abrupt size changes
//scale = Math.max((1000 + self.z) / 1000, 1.5); // Limit maximum scale to 1.5 to prevent abrupt size changes
scale = self.z / 5000;
@@ -374,8 +401,11 @@
initSquares();
var selector = new Selector();
selector.init(0);
game.addChild(selector);
+var counter = new Counter();
+counter.init(selector);
+game.addChild(counter);
var currentRightColor = 0;
var score = 0;
// Score display
var scoreTxt = new Text2('0', {
A white triangle pointing down.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A colorful rectangular button with the text "Play Again" with each letter in a different color picked from a nice palette.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.