User prompt
increase a quantity of sparks with each time
User prompt
make spark fall faster with each fall
User prompt
just a bit lower
User prompt
move zodiac lowr
User prompt
move zodiac to a lower third of a screen
User prompt
allow zodiac only move horizontally
User prompt
attach zodiac to a cursor
User prompt
leave just one zodiac
User prompt
play spark sound eahc time mote hits zodiac
User prompt
can you make fullscreen backgound
User prompt
how to change background image
Code edit (1 edits merged)
Please save this source code
Initial prompt
Zodiac groove
/**** * Classes ****/ // Note class to represent each note in the rhythm game var Note = Container.expand(function () { var self = Container.call(this); var noteGraphics = self.attachAsset('note', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); //<Assets used in the game will automatically appear here> // ZodiacSign class to represent each zodiac sign var ZodiacSign = Container.expand(function () { var self = Container.call(this); var zodiacGraphics = self.attachAsset('zodiac', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for zodiac signs }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize arrays and variables var zodiacSigns = []; var notes = []; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#fffffA" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Function to spawn a new note function spawnNote() { var newNote = new Note(); newNote.x = Math.random() * 2048; newNote.y = 0; notes.push(newNote); game.addChild(newNote); } // Function to update the score function updateScore() { score += 1; scoreTxt.setText(score); } // Function to handle note hit function handleNoteHit(note) { updateScore(); note.destroy(); notes.splice(notes.indexOf(note), 1); } // Initialize zodiac signs for (var i = 0; i < 12; i++) { var zodiac = new ZodiacSign(); zodiac.x = i % 4 * 512 + 256; zodiac.y = Math.floor(i / 4) * 683 + 341.5; zodiacSigns.push(zodiac); game.addChild(zodiac); } // Game update function game.update = function () { // Update notes for (var i = notes.length - 1; i >= 0; i--) { notes[i].update(); // Check for note hit for (var j = 0; j < zodiacSigns.length; j++) { if (notes[i].intersects(zodiacSigns[j])) { handleNoteHit(notes[i]); break; } } } // Spawn new note every 60 ticks if (LK.ticks % 60 == 0) { spawnNote(); } }; // Event listeners for touch events game.down = function (x, y, obj) { // Handle touch down event }; game.move = function (x, y, obj) { // Handle touch move event }; game.up = function (x, y, obj) { // Handle touch up event };
===================================================================
--- original.js
+++ change.js
@@ -1,106 +1,106 @@
-/****
+/****
* Classes
-****/
+****/
// Note class to represent each note in the rhythm game
var Note = Container.expand(function () {
- var self = Container.call(this);
- var noteGraphics = self.attachAsset('note', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 5;
- self.update = function () {
- self.y += self.speed;
- if (self.y > 2732) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var noteGraphics = self.attachAsset('note', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
});
//<Assets used in the game will automatically appear here>
// ZodiacSign class to represent each zodiac sign
var ZodiacSign = Container.expand(function () {
- var self = Container.call(this);
- var zodiacGraphics = self.attachAsset('zodiac', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.update = function () {
- // Update logic for zodiac signs
- };
+ var self = Container.call(this);
+ var zodiacGraphics = self.attachAsset('zodiac', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ // Update logic for zodiac signs
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize arrays and variables
var zodiacSigns = [];
var notes = [];
var score = 0;
var scoreTxt = new Text2('0', {
- size: 150,
- fill: "#ffffff"
+ size: 150,
+ fill: "#fffffA"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to spawn a new note
function spawnNote() {
- var newNote = new Note();
- newNote.x = Math.random() * 2048;
- newNote.y = 0;
- notes.push(newNote);
- game.addChild(newNote);
+ var newNote = new Note();
+ newNote.x = Math.random() * 2048;
+ newNote.y = 0;
+ notes.push(newNote);
+ game.addChild(newNote);
}
// Function to update the score
function updateScore() {
- score += 1;
- scoreTxt.setText(score);
+ score += 1;
+ scoreTxt.setText(score);
}
// Function to handle note hit
function handleNoteHit(note) {
- updateScore();
- note.destroy();
- notes.splice(notes.indexOf(note), 1);
+ updateScore();
+ note.destroy();
+ notes.splice(notes.indexOf(note), 1);
}
// Initialize zodiac signs
for (var i = 0; i < 12; i++) {
- var zodiac = new ZodiacSign();
- zodiac.x = i % 4 * 512 + 256;
- zodiac.y = Math.floor(i / 4) * 683 + 341.5;
- zodiacSigns.push(zodiac);
- game.addChild(zodiac);
+ var zodiac = new ZodiacSign();
+ zodiac.x = i % 4 * 512 + 256;
+ zodiac.y = Math.floor(i / 4) * 683 + 341.5;
+ zodiacSigns.push(zodiac);
+ game.addChild(zodiac);
}
// Game update function
game.update = function () {
- // Update notes
- for (var i = notes.length - 1; i >= 0; i--) {
- notes[i].update();
- // Check for note hit
- for (var j = 0; j < zodiacSigns.length; j++) {
- if (notes[i].intersects(zodiacSigns[j])) {
- handleNoteHit(notes[i]);
- break;
- }
- }
- }
- // Spawn new note every 60 ticks
- if (LK.ticks % 60 == 0) {
- spawnNote();
- }
+ // Update notes
+ for (var i = notes.length - 1; i >= 0; i--) {
+ notes[i].update();
+ // Check for note hit
+ for (var j = 0; j < zodiacSigns.length; j++) {
+ if (notes[i].intersects(zodiacSigns[j])) {
+ handleNoteHit(notes[i]);
+ break;
+ }
+ }
+ }
+ // Spawn new note every 60 ticks
+ if (LK.ticks % 60 == 0) {
+ spawnNote();
+ }
};
// Event listeners for touch events
game.down = function (x, y, obj) {
- // Handle touch down event
+ // Handle touch down event
};
game.move = function (x, y, obj) {
- // Handle touch move event
+ // Handle touch move event
};
game.up = function (x, y, obj) {
- // Handle touch up event
+ // Handle touch up event
};
\ No newline at end of file