Code edit (1 edits merged)
Please save this source code
User prompt
change the logic to make Detritus check for collision with Player and not Player check for colision with Detritus
Code edit (11 edits merged)
Please save this source code
User prompt
when taken, ignore current movement and animate the movment from thee detritus position to 150,1700 (recycle bin)
User prompt
when play intersects a Detritus, flag it as taken.
Code edit (5 edits merged)
Please save this source code
User prompt
add recyclebin to the game vertical center, on the left
Code edit (2 edits merged)
Please save this source code
User prompt
in DetritusFlying update, make rotation more chaotic
Code edit (1 edits merged)
Please save this source code
Code edit (23 edits merged)
Please save this source code
User prompt
Now add a new class DetritusFlying
Code edit (1 edits merged)
Please save this source code
Code edit (20 edits merged)
Please save this source code
User prompt
use Detritus class in road generateBackground, for that create a clone of attachAssetRadial that take an object insteade of an asset name but does the same thing
User prompt
use Detritus class in road generateBackground
User prompt
add a class for detritus
User prompt
Clone current system used to spanw Trees to spawn detritus
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
log variables before the line if (!jumpAction && jumpStep >= PLAYER_JUMP_STEP_MIN || jumpStep >= PLAYER_JUMP_STEP_MAX)
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;
- object.y = Math.cos(rotation) * -offsetTotal;
+ object.x = Math.sin(rotation) * offsetTotal - 125;
+ object.y = Math.cos(rotation) * -offsetTotal - 125;
//object.width = obj.width;
//object.height = obj.height;
object.anchorX = obj.anchorX;
object.anchorY = obj.anchorY;
@@ -129,40 +129,53 @@
anchorX: 0.1,
anchorY: 1
});
} 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();
- attachAssetRadial(background, 'tree' + treeIndex, {
- anchorR: 0.4 + 0.2 * Math.random(),
- anchorX: 0.5,
- anchorY: 1,
- scaleX: scale,
- scaleY: scale
- });
- }
if (Math.random() < ROAD_GEN_DETRITUS_CHANCE) {
var detritus = new Detritus();
- var scale = 0.9 + 0.2 * Math.random();
+ var scale = 1; //0.9 + 0.2 * Math.random();
attachObjectRadial(background, detritus, {
anchorR: 0.1 + 0.8 * Math.random(),
anchorX: 0.5,
- anchorY: 1,
+ anchorY: 0.1,
scaleX: Math.random() < 0.5 ? -scale : scale,
- scaleY: scale
+ scaleY: scale,
+ rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5
});
- }
- for (var i = 0; i < plantCount; i++) {
- var plantIndex = Math.floor(Math.random() * ROAD_GEN_PLANT_ASSETS);
- var scale = 0.9 + 0.2 * Math.random();
- attachAssetRadial(background, 'plant' + plantIndex, {
+ } 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, {
anchorR: 0.1 + 0.8 * Math.random(),
anchorX: 0.5,
- anchorY: 1,
+ anchorY: 0.1,
scaleX: Math.random() < 0.5 ? -scale : scale,
- scaleY: scale
+ scaleY: scale,
+ rotation: -Math.PI * 0.25 + Math.random() * Math.PI * 0.5
});
+ } 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();
+ attachAssetRadial(background, 'tree' + treeIndex, {
+ anchorR: 0.4 + 0.2 * Math.random(),
+ anchorX: 0.5,
+ anchorY: 1,
+ scaleX: scale,
+ scaleY: scale
+ });
+ }
+ for (var i = 0; i < plantCount; i++) {
+ var plantIndex = Math.floor(Math.random() * ROAD_GEN_PLANT_ASSETS);
+ var scale = 0.9 + 0.2 * Math.random();
+ attachAssetRadial(background, 'plant' + plantIndex, {
+ anchorR: 0.1 + 0.8 * Math.random(),
+ anchorX: 0.5,
+ anchorY: 1,
+ scaleX: Math.random() < 0.5 ? -scale : scale,
+ scaleY: scale
+ });
+ }
}
}
if (Math.random() < ROAD_GEN_CLOUD_CHANCE) {
var cloudIndex = Math.floor(Math.random() * ROAD_GEN_CLOUD_ASSETS);
@@ -568,8 +581,20 @@
}
;
body.pushAnimation(animationRun, PLAYER_POSE_TRANSITION);
});
+var DetritusFlying = ConfigContainer.expand(function (config) {
+ var self = ConfigContainer.call(this, config);
+ var detritusFlyingIndex = Math.floor(Math.random() * ROAD_GEN_DETRITUS_FLYING_ASSETS);
+ var scale = 0.9 + 0.2 * Math.random();
+ self.attachAsset('detritusFlying' + detritusFlyingIndex, {
+ anchorX: 0.5,
+ anchorY: 1,
+ scaleX: Math.random() < 0.5 ? -scale : scale,
+ scaleY: scale
+ });
+ return self;
+});
var Detritus = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
var detritusIndex = Math.floor(Math.random() * ROAD_GEN_DETRITUS_ASSETS);
var scale = 0.9 + 0.2 * Math.random();
@@ -727,10 +752,12 @@
var ROAD_GEN_TREE_ASSETS = 4;
var ROAD_GEN_TREE_CHANCE = 0.1;
var ROAD_GEN_CLOUD_ASSETS = 4;
var ROAD_GEN_CLOUD_CHANCE = 0.2;
-var ROAD_GEN_DETRITUS_ASSETS = 1;
+var ROAD_GEN_DETRITUS_ASSETS = 2;
var ROAD_GEN_DETRITUS_CHANCE = 0.1;
+var ROAD_GEN_DETRITUS_FLYING_ASSETS = 2;
+var ROAD_GEN_DETRITUS_FLYING_CHANCE = 0.1;
;
// Player Constants
var PLAYER_SPACING = ROAD_SEGMENT_ANGLE / 8; // 1/8 of a segment
var PLAYER_POSE_TRANSITION = 0.1;
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.