Code edit (3 edits merged)
Please save this source code
User prompt
Ignore taps during intro
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: K is not defined' in or related to this line: 'K.clearInterval(startClearInterval);' Line Number: 649
Code edit (1 edits merged)
Please save this source code
User prompt
play start sound after press start
User prompt
wait 1sec before gameover
Code edit (1 edits merged)
Please save this source code
User prompt
in the intro, play the fallsound when ninja arrive on platform
User prompt
cool. in the intro, add a y move to make it a parabolic jump
User prompt
the asset is not changed because of the ninja update logic...add an intro flag and use it in the ninja.update to prenvent updates
User prompt
for the intro animation, use ninjaRun graphic
User prompt
add an intro annimationwhere the ninja with asset jumps from x<0 to the 1st platform
User prompt
to ajust to distance of new platform per level, you must use platformNext.speedRatio
User prompt
like for the width, make the distance between platforms depend on the level (1st levels quite close, the far)
Code edit (2 edits merged)
Please save this source code
User prompt
log every time stick.y is set with the name of the function. use log() function
User prompt
log every time ninja.y is set with the name of the function. use log() function
Code edit (2 edits merged)
Please save this source code
User prompt
add an isDebug global variable
Code edit (1 edits merged)
Please save this source code
Code edit (16 edits merged)
Please save this source code
User prompt
for ninja run anim, use the following sequence : 1,2,1,3,4,3
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -3,8 +3,13 @@
****/
// Clouds class
var Clouds = Container.expand(function () {
var self = Container.call(this);
+ var bridGraphics1 = self.attachAsset('birds1', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 480 + Math.random() * 128
+ });
var cloudGraphics3 = self.attachAsset('clouds2', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.95,
@@ -38,8 +43,9 @@
self.speed1 = 0.5 + 0.5 * Math.random();
self.speed2 = 0.5 + 0.5 * Math.random();
self.speed3 = 0.1 + 0.25 * Math.random();
self.speed4 = 0.1 + 0.25 * Math.random();
+ self.speed4 = 1 + 0.25 * Math.random();
self.update = function () {
cloudGraphics.x -= self.speed1;
if (cloudGraphics.x + cloudGraphics.width / 2 < 0) {
cloudGraphics.x = 2048 + cloudGraphics.width / 2;
@@ -59,8 +65,13 @@
if (cloudGraphics4.x + cloudGraphics4.width / 2 < 0) {
cloudGraphics4.x = 2048 + cloudGraphics4.width / 2 + Math.random() * 1024;
cloudGraphics4.y = cloudGraphics4.heigth + Math.random() * 320;
}
+ bridGraphics1.x += self.speed4;
+ if (bridGraphics1.x + bridGraphics1.width / 2 > 2048) {
+ bridGraphics1.x = -bridGraphics1 / 2 - Math.random() * 1024;
+ bridGraphics1.y = bridGraphics1.heigth + Math.random() * 320;
+ }
};
});
//<Assets used in the game will automatically appear here>
// Ninja class
@@ -80,9 +91,9 @@
});
self.ninjaRun3 = self.attachAsset('ninjaRun3', {
anchorX: 0.5,
anchorY: 1.0,
- y: 30
+ y: 20
});
self.ninjaRun.visible = false; // Initially hide the running ninja graphic
self.ninjaRun2.visible = false; // Initially hide the running ninja graphic
self.ninjaRun3.visible = false; // Initially hide the running ninja graphic
@@ -178,42 +189,8 @@
/****
* Game Code
****/
// Initialize game variables
-function _typeof(o) {
- "@babel/helpers - typeof";
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-function _defineProperty(e, r, t) {
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-function _toPropertyKey(t) {
- var i = _toPrimitive(t, "string");
- return "symbol" == _typeof(i) ? i : i + "";
-}
-function _toPrimitive(t, r) {
- if ("object" != _typeof(t) || !t) {
- return t;
- }
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != _typeof(i)) {
- return i;
- }
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
var clouds;
var platformMinWidth = 100;
var level = 1; // Initialize the level variable
var platformMaxWidth = 400;
@@ -317,9 +294,9 @@
game.addChild(midground2);
createInitialPlatforms();
if (platformCurrent) {
ninja.x = platformCurrent.x;
- ninja.y = platformCurrent.y - platformCurrent.height + 12; // Adjusted y-coordinate to ensure ninja is visible on the first hill with an offset of 20
+ ninja.y = platformCurrent.y - platformCurrent.height + 20; // Adjusted y-coordinate to ensure ninja is visible on the first hill with an offset of 20
} else {
console.error("platformCurrent is not defined");
}
game.addChildAt(ninja, game.children.indexOf(platformCurrent) - 1);