Code edit (1 edits merged)
Please save this source code
User prompt
Powerpuff Snow Slide Adventure
Initial prompt
Toca snow slide (2014). The powerpuff girls have been to snowy mountain. Tap on the powerpuff girls to make belly slide down the snow big hill to make snow tracks. Finish all 3 levels. Tap the how to play button.
/**** 
* Plugins
****/ 
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/**** 
* Classes
****/ 
var Obstacle = Container.expand(function () {
	var self = Container.call(this);
	var obstacleGraphics = self.attachAsset('obstacle', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	return self;
});
var PowerpuffGirl = Container.expand(function (girlType) {
	var self = Container.call(this);
	self.girlType = girlType || 'blossom';
	self.isSliding = false;
	self.velocityY = 0;
	self.velocityX = 0;
	self.trackPoints = [];
	var girlGraphics = self.attachAsset(self.girlType, {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.startSlide = function () {
		if (!self.isSliding) {
			self.isSliding = true;
			self.velocityY = 5;
			self.velocityX = Math.random() * 2 - 1; // Random horizontal drift
			LK.getSound('slide').play();
			// Add rotation animation while sliding
			tween(girlGraphics, {
				rotation: Math.PI * 2
			}, {
				duration: 2000,
				easing: tween.linear
			});
		}
	};
	self.update = function () {
		if (self.isSliding) {
			// Apply gravity and movement
			self.velocityY += 0.2;
			self.x += self.velocityX;
			self.y += self.velocityY;
			// Create snow tracks
			if (LK.ticks % 5 === 0) {
				var trackPoint = {
					x: self.x,
					y: self.y,
					created: LK.ticks
				};
				self.trackPoints.push(trackPoint);
				// Create visual track
				var track = LK.getAsset('snowTrack', {
					anchorX: 0.5,
					anchorY: 0.5,
					x: self.x,
					y: self.y,
					alpha: 0.6
				});
				game.addChild(track);
				tracks.push(track);
			}
			// Keep girl within bounds
			if (self.x < 50) {
				self.x = 50;
				self.velocityX = Math.abs(self.velocityX);
			}
			if (self.x > 1998) {
				self.x = 1998;
				self.velocityX = -Math.abs(self.velocityX);
			}
		}
	};
	self.down = function (x, y, obj) {
		self.startSlide();
	};
	return self;
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x87ceeb
});
/**** 
* Game Code
****/ 
var currentLevel = storage.currentLevel || 1;
var girls = [];
var obstacles = [];
var tracks = [];
var levelComplete = false;
var mountain;
// Level configurations
var levelConfigs = [{
	// Level 1
	mountainAsset: 'mountain1',
	girlStartY: 200,
	finishLine: 1400,
	obstacleCount: 3
}, {
	// Level 2
	mountainAsset: 'mountain2',
	girlStartY: 150,
	finishLine: 1500,
	obstacleCount: 5
}, {
	// Level 3
	mountainAsset: 'mountain3',
	girlStartY: 100,
	finishLine: 1600,
	obstacleCount: 7
}];
// Level text
var levelText = new Text2('Level ' + currentLevel, {
	size: 80,
	fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
// Instructions text
var instructionText = new Text2('Tap the Powerpuff Girls to slide!', {
	size: 50,
	fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0);
instructionText.y = 100;
LK.gui.top.addChild(instructionText);
function initializeLevel(level) {
	// Clear previous level
	girls.forEach(function (girl) {
		girl.destroy();
	});
	obstacles.forEach(function (obstacle) {
		obstacle.destroy();
	});
	tracks.forEach(function (track) {
		track.destroy();
	});
	if (mountain) {
		mountain.destroy();
	}
	girls = [];
	obstacles = [];
	tracks = [];
	levelComplete = false;
	var config = levelConfigs[level - 1];
	// Create mountain background
	mountain = game.addChild(LK.getAsset(config.mountainAsset, {
		anchorX: 0.5,
		anchorY: 0,
		x: 1024,
		y: 500
	}));
	// Create Powerpuff Girls
	var girlTypes = ['blossom', 'bubbles', 'buttercup'];
	for (var i = 0; i < 3; i++) {
		var girl = new PowerpuffGirl(girlTypes[i]);
		girl.x = 400 + i * 400;
		girl.y = config.girlStartY;
		girls.push(girl);
		game.addChild(girl);
	}
	// Create obstacles
	for (var j = 0; j < config.obstacleCount; j++) {
		var obstacle = new Obstacle();
		obstacle.x = Math.random() * 1800 + 100;
		obstacle.y = Math.random() * 800 + 600;
		obstacles.push(obstacle);
		game.addChild(obstacle);
	}
}
function checkLevelCompletion() {
	var completedGirls = 0;
	girls.forEach(function (girl) {
		if (girl.y >= levelConfigs[currentLevel - 1].finishLine) {
			completedGirls++;
		}
	});
	if (completedGirls >= 3 && !levelComplete) {
		levelComplete = true;
		LK.getSound('complete').play();
		// Flash effect
		LK.effects.flashScreen(0xffffff, 500);
		// Advance to next level
		setTimeout(function () {
			if (currentLevel < 3) {
				currentLevel++;
				storage.currentLevel = currentLevel;
				levelText.setText('Level ' + currentLevel);
				initializeLevel(currentLevel);
			} else {
				// Game completed
				LK.showYouWin();
			}
		}, 1500);
	}
}
function checkCollisions() {
	girls.forEach(function (girl) {
		obstacles.forEach(function (obstacle) {
			if (girl.intersects(obstacle) && girl.isSliding) {
				// Bounce off obstacle
				girl.velocityX = -girl.velocityX * 1.5;
				girl.velocityY *= 0.7;
				// Visual effect
				LK.effects.flashObject(obstacle, 0xff0000, 300);
			}
		});
	});
}
// Initialize first level
initializeLevel(currentLevel);
game.update = function () {
	checkCollisions();
	checkLevelCompletion();
	// Clean up old tracks
	for (var i = tracks.length - 1; i >= 0; i--) {
		var track = tracks[i];
		if (LK.ticks - track.created > 300) {
			// Remove after 5 seconds
			track.destroy();
			tracks.splice(i, 1);
		}
	}
	// Update track fade
	tracks.forEach(function (track) {
		var age = LK.ticks - track.created;
		track.alpha = Math.max(0.1, 0.8 - age / 300);
	});
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,239 @@
-/****
+/**** 
+* Plugins
+****/ 
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/**** 
+* Classes
+****/ 
+var Obstacle = Container.expand(function () {
+	var self = Container.call(this);
+	var obstacleGraphics = self.attachAsset('obstacle', {
+		anchorX: 0.5,
+		anchorY: 0.5
+	});
+	return self;
+});
+var PowerpuffGirl = Container.expand(function (girlType) {
+	var self = Container.call(this);
+	self.girlType = girlType || 'blossom';
+	self.isSliding = false;
+	self.velocityY = 0;
+	self.velocityX = 0;
+	self.trackPoints = [];
+	var girlGraphics = self.attachAsset(self.girlType, {
+		anchorX: 0.5,
+		anchorY: 0.5
+	});
+	self.startSlide = function () {
+		if (!self.isSliding) {
+			self.isSliding = true;
+			self.velocityY = 5;
+			self.velocityX = Math.random() * 2 - 1; // Random horizontal drift
+			LK.getSound('slide').play();
+			// Add rotation animation while sliding
+			tween(girlGraphics, {
+				rotation: Math.PI * 2
+			}, {
+				duration: 2000,
+				easing: tween.linear
+			});
+		}
+	};
+	self.update = function () {
+		if (self.isSliding) {
+			// Apply gravity and movement
+			self.velocityY += 0.2;
+			self.x += self.velocityX;
+			self.y += self.velocityY;
+			// Create snow tracks
+			if (LK.ticks % 5 === 0) {
+				var trackPoint = {
+					x: self.x,
+					y: self.y,
+					created: LK.ticks
+				};
+				self.trackPoints.push(trackPoint);
+				// Create visual track
+				var track = LK.getAsset('snowTrack', {
+					anchorX: 0.5,
+					anchorY: 0.5,
+					x: self.x,
+					y: self.y,
+					alpha: 0.6
+				});
+				game.addChild(track);
+				tracks.push(track);
+			}
+			// Keep girl within bounds
+			if (self.x < 50) {
+				self.x = 50;
+				self.velocityX = Math.abs(self.velocityX);
+			}
+			if (self.x > 1998) {
+				self.x = 1998;
+				self.velocityX = -Math.abs(self.velocityX);
+			}
+		}
+	};
+	self.down = function (x, y, obj) {
+		self.startSlide();
+	};
+	return self;
+});
+
+/**** 
 * Initialize Game
-****/
+****/ 
 var game = new LK.Game({
-	backgroundColor: 0x000000
-});
\ No newline at end of file
+	backgroundColor: 0x87ceeb
+});
+
+/**** 
+* Game Code
+****/ 
+var currentLevel = storage.currentLevel || 1;
+var girls = [];
+var obstacles = [];
+var tracks = [];
+var levelComplete = false;
+var mountain;
+// Level configurations
+var levelConfigs = [{
+	// Level 1
+	mountainAsset: 'mountain1',
+	girlStartY: 200,
+	finishLine: 1400,
+	obstacleCount: 3
+}, {
+	// Level 2
+	mountainAsset: 'mountain2',
+	girlStartY: 150,
+	finishLine: 1500,
+	obstacleCount: 5
+}, {
+	// Level 3
+	mountainAsset: 'mountain3',
+	girlStartY: 100,
+	finishLine: 1600,
+	obstacleCount: 7
+}];
+// Level text
+var levelText = new Text2('Level ' + currentLevel, {
+	size: 80,
+	fill: 0xFFFFFF
+});
+levelText.anchor.set(0.5, 0);
+LK.gui.top.addChild(levelText);
+// Instructions text
+var instructionText = new Text2('Tap the Powerpuff Girls to slide!', {
+	size: 50,
+	fill: 0xFFFFFF
+});
+instructionText.anchor.set(0.5, 0);
+instructionText.y = 100;
+LK.gui.top.addChild(instructionText);
+function initializeLevel(level) {
+	// Clear previous level
+	girls.forEach(function (girl) {
+		girl.destroy();
+	});
+	obstacles.forEach(function (obstacle) {
+		obstacle.destroy();
+	});
+	tracks.forEach(function (track) {
+		track.destroy();
+	});
+	if (mountain) {
+		mountain.destroy();
+	}
+	girls = [];
+	obstacles = [];
+	tracks = [];
+	levelComplete = false;
+	var config = levelConfigs[level - 1];
+	// Create mountain background
+	mountain = game.addChild(LK.getAsset(config.mountainAsset, {
+		anchorX: 0.5,
+		anchorY: 0,
+		x: 1024,
+		y: 500
+	}));
+	// Create Powerpuff Girls
+	var girlTypes = ['blossom', 'bubbles', 'buttercup'];
+	for (var i = 0; i < 3; i++) {
+		var girl = new PowerpuffGirl(girlTypes[i]);
+		girl.x = 400 + i * 400;
+		girl.y = config.girlStartY;
+		girls.push(girl);
+		game.addChild(girl);
+	}
+	// Create obstacles
+	for (var j = 0; j < config.obstacleCount; j++) {
+		var obstacle = new Obstacle();
+		obstacle.x = Math.random() * 1800 + 100;
+		obstacle.y = Math.random() * 800 + 600;
+		obstacles.push(obstacle);
+		game.addChild(obstacle);
+	}
+}
+function checkLevelCompletion() {
+	var completedGirls = 0;
+	girls.forEach(function (girl) {
+		if (girl.y >= levelConfigs[currentLevel - 1].finishLine) {
+			completedGirls++;
+		}
+	});
+	if (completedGirls >= 3 && !levelComplete) {
+		levelComplete = true;
+		LK.getSound('complete').play();
+		// Flash effect
+		LK.effects.flashScreen(0xffffff, 500);
+		// Advance to next level
+		setTimeout(function () {
+			if (currentLevel < 3) {
+				currentLevel++;
+				storage.currentLevel = currentLevel;
+				levelText.setText('Level ' + currentLevel);
+				initializeLevel(currentLevel);
+			} else {
+				// Game completed
+				LK.showYouWin();
+			}
+		}, 1500);
+	}
+}
+function checkCollisions() {
+	girls.forEach(function (girl) {
+		obstacles.forEach(function (obstacle) {
+			if (girl.intersects(obstacle) && girl.isSliding) {
+				// Bounce off obstacle
+				girl.velocityX = -girl.velocityX * 1.5;
+				girl.velocityY *= 0.7;
+				// Visual effect
+				LK.effects.flashObject(obstacle, 0xff0000, 300);
+			}
+		});
+	});
+}
+// Initialize first level
+initializeLevel(currentLevel);
+game.update = function () {
+	checkCollisions();
+	checkLevelCompletion();
+	// Clean up old tracks
+	for (var i = tracks.length - 1; i >= 0; i--) {
+		var track = tracks[i];
+		if (LK.ticks - track.created > 300) {
+			// Remove after 5 seconds
+			track.destroy();
+			tracks.splice(i, 1);
+		}
+	}
+	// Update track fade
+	tracks.forEach(function (track) {
+		var age = LK.ticks - track.created;
+		track.alpha = Math.max(0.1, 0.8 - age / 300);
+	});
+};
\ No newline at end of file