User prompt
Add a background element to the forest layer with anchor .5,1 at the bottom of the screen
User prompt
Add a layer before foreground called forest
User prompt
In player gameover check I think you should add the y of foreground not subtract it
Code edit (1 edits merged)
Please save this source code
User prompt
In game over check use layer y
User prompt
Set game over if the player falls out of the screen factoring in the layer
User prompt
Only allow the layer to scroll up
User prompt
Never allow parallaxValue to become a larger value
User prompt
Smooth parallaxValue
User prompt
Create a variable for the value you pass to setParallaxY
User prompt
When removing a bell, also insert a new one
User prompt
Use setParallaxY to set layer y
User prompt
In tick, calculate player relative position on the screen and update the such that the player is always at the center of the screen
User prompt
When a player touches a bell, remove the bell
User prompt
If the player hits a bell, set player speed y to -60
User prompt
Set speed y to -60 when jumping
User prompt
Set speed y to -70 when jumping
User prompt
Implement jumping with a speedy variable
User prompt
On tap, if the player is on the ground, make the player jump
User prompt
Add 5 bells rather than one using the add bell method
User prompt
Remove the setup method in game. We don’t want a setup method
User prompt
Fix Bug: 'ReferenceError: Can't find variable: bells' in this line: 'var lastBellY = bells.length > 0 ? bells[bells.length - 1].y : 2732;' Line Number: 47
User prompt
Remove the line where bells array get initialized
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'bells.length')' in this line: 'var lastBellY = bells.length > 0 ? bells[bells.length - 1].y : 2732;' Line Number: 47
User prompt
Remove the code the redefines bells above score text, rewrite the score text variable as well
===================================================================
--- original.js
+++ change.js
@@ -37,8 +37,11 @@
});
var Game = Container.expand(function () {
var self = Container.call(this);
var forest = self.addChild(new ParallaxLayer());
+ var background = forest.createAsset('background', 'Background Element', .5, 1);
+ background.y = 2732;
+ forest.addChild(background);
var foreground = self.addChild(new ParallaxLayer());
var player = foreground.addChild(new Player());
player.x = 2048 / 2;
player.targetX = player.x;
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.