User prompt
Remove the code the redefines bells above score text, rewrite the score text variable as well
User prompt
Add 5 bells on startup
User prompt
Add bell should just use the y position of the last entry from the bell array to determine y position
User prompt
On foreground set speed to 1
User prompt
Set weight:800 on score text
User prompt
Move code out of setup method into game constructor
User prompt
Fix Bug: 'TypeError: self.addBell is not a function. (In 'self.addBell(2732)', 'self.addBell' is undefined)' in this line: 'self.addBell(2732);' Line Number: 34
User prompt
Move code out of setup method into game constructor
User prompt
Define add bell outside the setup methid
User prompt
Add a new method that dynamically inserts one more bell in the game, this bell should have a random x position but a y that is 1/2 to 2/3 times the screen height smaller than the previous bell
User prompt
Only add one bell when game starts
User prompt
Update x movement code on player to move faster or slower depending on the distance to target
User prompt
Add a foreground parallax layer to game, attach player and bells to this layer
User prompt
Make the parallax impact a property of the parallax class such that speed can be set individually per player
User prompt
Add a parallax layer class to the game. The class should calculate the actual y based on a y given to the game to control how fast it scrolls. The parallax effect is on the y axis
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.backgroundLayer.move')' in this line: 'this.backgroundLayer.move();' Line Number: 66
User prompt
Fix Bug: 'ReferenceError: Can't find variable: backgroundLayer' in this line: 'backgroundLayer.move();' Line Number: 65
User prompt
Fix Bug: 'ReferenceError: Can't find variable: backgroundLayer' in this line: 'backgroundLayer.move();' Line Number: 65
User prompt
We want to have layers in the game that scrolls at different speed with a parallax effect. Set this up
User prompt
Also set target x when tapping the screen
User prompt
When setting up the player initialize target x as the same as x
User prompt
When moving my mouse on the screen, set target x on player. Then in tick move player towards target z
User prompt
Player has two update methods, delete one of them
User prompt
Fix Bug: 'TypeError: player.update is not a function. (In 'player.update()', 'player.update' is undefined)' in this line: 'player.update();' Line Number: 37
User prompt
Fix Bug: 'TypeError: player.update is not a function. (In 'player.update()', 'player.update' is undefined)' in this line: 'player.update();' Line Number: 37
===================================================================
--- original.js
+++ change.js
@@ -33,9 +33,10 @@
var bells = [];
var scoreTxt;
var isGameOver = false;
function setup() {
- player = self.addChild(new Player());
+ var foreground = self.addChild(new ParallaxLayer());
+ player = foreground.addChild(new Player());
player.x = 2048 / 2;
player.targetX = player.x;
player.y = 2732 - player.height;
scoreTxt = new Text2('0', {
@@ -44,9 +45,9 @@
});
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
for (var i = 0; i < 10; i++) {
- var bell = self.addChild(new Bell());
+ var bell = foreground.addChild(new Bell());
bell.x = Math.random() * (2048 - bell.width);
bell.y = Math.random() * (2732 - bell.height);
bells.push(bell);
}
Tree line of snowy pine trees. Cartoon. Black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Mountain valley with snowy trees. Scenic view. Nighttime. Cartoon. Black background. New moon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Background mountains, nighttime, snow topped Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d platform snowy ground. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cute cartoon rabbit, jumping upwards facing camera. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Starry night sky, northern lights, looking up. Cartoon style. Above clouds Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single White Christmas bell. White decorations. Cartoon. Outline Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White Simple Cartoon snowflake Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.