Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: player.slideStart is not a function' in or related to this line: 'player.slideStart();' Line Number: 1109
Code edit (1 edits merged)
Please save this source code
User prompt
add a flag to start detecting swipe only after tap
Code edit (15 edits merged)
Please save this source code
User prompt
don't forget to reset startY
User prompt
now for jump action detect a swipe up using down and move events
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -70,8 +70,15 @@
scaleX: 0.95,
scaleY: 0.95,
tint: 0x62C344 // TEMP DEBUG0x555555
});
+ self.segmentRiver = self.attachAsset('river', {
+ anchorX: 1,
+ anchorY: 1,
+ scaleX: 0.95,
+ scaleY: 0.95,
+ visible: false
+ });
if (false && config.index % 3 === 0) {
attachAssetRadial(self, 'square', {
offset: 200,
width: 100,
@@ -121,8 +128,9 @@
}
function generateBackground() {
console.log(self.distance);
background.removeChildren();
+ self.segmentRiver.visible = false;
var plantCount = Math.floor(Math.random() * (ROAD_GEN_PLANT_MAX + 1));
if (self.distance === SCORE_TOTAL_DISTANCE) {
attachAssetRadial(background, 'flag', {
anchorR: 0.5,
@@ -141,9 +149,8 @@
scaleY: scale,
rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5,
levitOffset: 125
});
- self.segment.visible = false;
} else if (Math.random() < ROAD_GEN_DETRITUS_FLYING_CHANCE) {
var detritusFlying = new DetritusFlying();
var scale = 1; //0.9 + 0.2 * Math.random();
attachObjectRadial(background, detritusFlying, {
@@ -155,9 +162,12 @@
rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5,
flying: 1,
levitOffset: 525
});
- } else if (Math.random() < ROAD_GEN_FRAGILE_NATURE_CHANCE) {
+ } else if (road.riverSegmentCount < ROAD_MAX_RIVER_SEGMENTS && Math.random() < ROAD_GEN_FRAGILE_NATURE_CHANCE) {
+ self.segmentRiver.visible = true;
+ road.riverSegmentCount++;
+ /*
var fragileNature = new FragileNature();
var scale = 1; //0.9 + 0.2 * Math.random();
attachObjectRadial(background, fragileNature, {
anchorR: 0.1 + 0.8 * Math.random(),
@@ -167,8 +177,9 @@
scaleY: scale,
rotation: 0,
levitOffset: 125
});
+ */
} else {
if (Math.random() < ROAD_GEN_TREE_CHANCE) {
var treeIndex = Math.floor(Math.random() * ROAD_GEN_TREE_ASSETS);
var scale = 0.9 + 0.2 * Math.random();
@@ -276,8 +287,9 @@
scaleY: 0.27,
rotation: i * ROAD_SEGMENT_ANGLE
});
}
+ self.riverSegmentCount = 0;
self.attachAsset('circle', {
width: 500,
height: 500,
anchorX: 0.5,
@@ -842,8 +854,9 @@
var ROAD_SEGMENT_ANGLE = MATH_2_PI / ROAD_SEGMENT_COUNT;
var ROAD_SEGMENT_HEIGHT = 1000;
var ROAD_SEGMENT_DESTROY = -2;
var ROAD_SEGMENT_FADEOUT = 0.015;
+var ROAD_MAX_RIVER_SEGMENTS = 1;
var ROAD_FREE_RUN_COUNT = 5;
var ROAD_STEP_COUNT = 5;
var ROAD_STEP_DEFAULT = 10;
var ROAD_STEP_HEIGHT_BASE = 512;
@@ -860,9 +873,9 @@
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 = 2;
-var ROAD_GEN_FRAGILE_NATURE_CHANCE = 0.05;
+var ROAD_GEN_FRAGILE_NATURE_CHANCE = 0.1;
;
// Player Constants
var PLAYER_SPACING = ROAD_SEGMENT_ANGLE / 8; // 1/8 of a segment
var PLAYER_POSE_TRANSITION = 0.1;
@@ -894,8 +907,9 @@
var gameOver = false;
var distanceRemaining = SCORE_TOTAL_DISTANCE;
;
// Instances
+var road;
var background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
@@ -909,9 +923,9 @@
var sun = game.addChild(new Sun({
x: GAME_WIDTH / 2,
y: 50
}));
-var road = game.addChild(new Road({
+road = game.addChild(new Road({
x: GAME_WIDTH / 2,
y: GAME_HEIGHT - GAME_WIDTH / 2
}));
var player = game.addChild(new Player({
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.