Code edit (3 edits merged)
Please save this source code
User prompt
Add a new class BoilingLava that emits lava bubbles (circle asset)
User prompt
Play lose sound when touching river
User prompt
Play jump sound when jumping
Code edit (1 edits merged)
Please save this source code
User prompt
add a red flash if fall in the river
Code edit (8 edits merged)
Please save this source code
User prompt
if player fall in the river call gameover
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: road is undefined' in or related to this line: 'if (Math.random() < ROAD_GEN_DETRITUS_CHANCE) {' Line Number: 183
User prompt
Please fix the bug: 'TypeError: road is undefined' in or related to this line: 'if (Math.random() < ROAD_GEN_DETRITUS_CHANCE) {' Line Number: 183
Code edit (1 edits merged)
Please save this source code
User prompt
play bgMusic in loop
Code edit (9 edits merged)
Please save this source code
User prompt
play collectDetritus when taking a detritus
Code edit (1 edits merged)
Please save this source code
User prompt
add a class FragileNature like Detritus
Code edit (1 edits merged)
Please save this source code
User prompt
enhance the throw to bin anim by progressively reducing detritus size while approaching the target
Code edit (1 edits merged)
Please save this source code
User prompt
destroy taken detritus when they reach the target position
Code edit (1 edits merged)
Please save this source code
User prompt
when Detritus is taken, detach it from its parent and attach it to the game at the same position
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -107,10 +107,10 @@
}
function attachObjectRadial(parent, object, obj) {
var offsetTotal = ROAD_SEGMENT_HEIGHT - (obj.offset || 10);
var rotation = -(1 - obj.anchorR) * ROAD_SEGMENT_ANGLE;
- object.x = Math.sin(rotation) * offsetTotal - 125 - 400 * (obj.flying || 0);
- object.y = Math.cos(rotation) * -offsetTotal - 125 - 400 * (obj.flying || 0);
+ object.x = Math.sin(rotation) * offsetTotal - (obj.levitOffset || 0); //125* (obj.levitOffset || 0) - 400 * (obj.flying || 0);
+ object.y = Math.cos(rotation) * -offsetTotal - (obj.levitOffset || 0);
//object.width = obj.width;
//object.height = obj.height;
object.anchorX = obj.anchorX;
object.anchorY = obj.anchorY;
@@ -138,9 +138,10 @@
anchorX: 0.5,
anchorY: 0.1,
scaleX: Math.random() < 0.5 ? -scale : scale,
scaleY: scale,
- rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5
+ rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5,
+ levitOffset: 125
});
} else if (Math.random() < ROAD_GEN_DETRITUS_FLYING_CHANCE) {
var detritusFlying = new DetritusFlying();
var scale = 1; //0.9 + 0.2 * Math.random();
@@ -150,9 +151,10 @@
anchorY: 0.1,
scaleX: Math.random() < 0.5 ? -scale : scale,
scaleY: scale,
rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5,
- flying: 1
+ flying: 1,
+ levitOffset: 525
});
} else if (Math.random() < ROAD_GEN_FRAGILE_NATURE_CHANCE) {
var fragileNature = new FragileNature();
var scale = 1; //0.9 + 0.2 * Math.random();
@@ -161,9 +163,10 @@
anchorX: 0.5,
anchorY: 0.1,
scaleX: Math.random() < 0.5 ? -scale : scale,
scaleY: scale,
- rotation: 0
+ rotation: 0,
+ levitOffset: 125
});
} else {
if (Math.random() < ROAD_GEN_TREE_CHANCE) {
var treeIndex = Math.floor(Math.random() * ROAD_GEN_TREE_ASSETS);
@@ -614,30 +617,11 @@
});
self.taken = false;
self.update = function () {
if (self.taken) {
- var targetX = recycleBin.x;
- var targetY = recycleBin.y;
- var speed = 10;
- var dx = targetX - self.x;
- var dy = targetY - self.y;
- var distance = Math.sqrt(dx * dx + dy * dy);
- if (distance > speed) {
- self.x += dx / distance * speed;
- self.y += dy / distance * speed;
- self.scale.x *= 0.9975;
- self.scale.y *= 0.9975;
- } else {
- self.x = targetX;
- self.y = targetY;
- self.destroy();
- }
+ // TODO : Do domthing when Fragile Nature is hit
} else if (!self.taken && player.body.torso.intersects(self)) {
self.taken = true;
- var globalPosition = self.parent.toGlobal(self.position);
- self.parent.removeChild(self);
- game.addChild(self);
- self.position = game.toLocal(globalPosition);
}
};
return self;
});
@@ -674,8 +658,9 @@
var globalPosition = self.parent.toGlobal(self.position);
self.parent.removeChild(self);
game.addChild(self);
self.position = game.toLocal(globalPosition);
+ LK.getSound('collectDetritus').play();
} else {
self.rotation += 0.05 + (Math.random() - 0.25) * 0.1;
}
};
@@ -870,9 +855,9 @@
var ROAD_GEN_DETRITUS_ASSETS = 2;
var ROAD_GEN_DETRITUS_CHANCE = 0.05;
var ROAD_GEN_DETRITUS_FLYING_ASSETS = 2;
var ROAD_GEN_DETRITUS_FLYING_CHANCE = 0.05;
-var ROAD_GEN_FRAGILE_NATURE_ASSETS = 1;
+var ROAD_GEN_FRAGILE_NATURE_ASSETS = 2;
var ROAD_GEN_FRAGILE_NATURE_CHANCE = 0.05;
;
// Player Constants
var PLAYER_SPACING = ROAD_SEGMENT_ANGLE / 8; // 1/8 of a segment
white
circle sliced into many pieces, flat image. 2d, white background, shadowless.
pixel art of a tall, tree. game asset, 2d, white background, shadowless.
pixel art cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark space.
flying lava bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a bonus crystal ball with the recycle symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top view A green round start button empty in the center like a ring.