User prompt
the player should jump from a platform to another one
User prompt
the player should jump higher
User prompt
the player should follow the X mouse position
User prompt
the platform should be placed randomly on screen
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'push')' in or related to this line: 'obstacles.push(game.addChild(platform));' Line Number: 68
User prompt
the platform should be static and all present at the begining
Initial prompt
Jump to Climb
===================================================================
--- original.js
+++ change.js
@@ -8,9 +8,9 @@
anchorY: 0.5
});
self.speedY = 0;
self.gravity = 0.5;
- self.jumpForce = -15;
+ self.jumpForce = -20;
self.jump = function () {
self.speedY = self.jumpForce;
};
self.update = function () {
@@ -20,8 +20,15 @@
if (self.y > 2732 - 25) {
self.y = 2732 - 25;
self.speedY = 0;
}
+ // Make the player land on platforms
+ for (var i = 0; i < obstacles.length; i++) {
+ if (self.intersects(obstacles[i]) && self.speedY > 0) {
+ self.y = obstacles[i].y - self.height / 2;
+ self.speedY = 0;
+ }
+ }
};
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
a little squirrel with sun glasses and earring. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d flat leaf green horizontal platform. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
acorn. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.