Code edit (13 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
landscape tiles should have a background asset
Code edit (1 edits merged)
Please save this source code
User prompt
after updating the player in the on tick function, call the update function of the interface, making sure to supply the player.distanceTravelled as the first parameter
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -167,8 +167,11 @@
});
var LandscapeTile = Container.expand(function (x, y, {lookup, xIndex, yIndex, width, height, density, pickups, monsters, player, key, landscapeTiles, rampList}) {
var self = Container.call(this);
var obstructions = [];
+ var background = self.createAsset('landscapeBackground', 'Landscape background', 0.5, 0.5);
+ background.width = width;
+ background.height = height;
var visual = self.createAsset('hitbox', 'Landscape area', 0.5, 0.5);
visual.alpha = 0;
visual.width = width;
visual.height = height;
@@ -511,9 +514,9 @@
}
scoreText.x = -5;
scoreText.y = scoreIcon.height;
scoreText.anchor.set(0, 0);
- distanceText.x = STAGE_WIDTH / 2 - 500;
+ distanceText.x = STAGE_WIDTH / 2 - 350;
distanceText.y = 30;
distanceText.anchor.set(1, 0);
;
self.x = x;
@@ -522,11 +525,10 @@
self.changeScore = changeScore;
self.changeLives = changeLives;
;
function update(distance) {
- distanceText.setText(Math.round(distance) + 'm');
+ distanceText.setText(Math.round(distance * SCREEN_METERAGE) + 'm');
}
- ;
function changeLives(amount) {
lives += amount;
for (var i = 0; i < lifeIcons.length; i++) {
lifeIcons[i].alpha = i < lives ? 1 : 0.5;
@@ -549,18 +551,19 @@
});
;
var STAGE_WIDTH = 2048;
var STAGE_HEIGHT = 2732;
+var SCREEN_METERAGE = 1 / 150;
+var MONSTER_SPAWN_DIST = 100 / SCREEN_METERAGE;
+var DIFFICULTY_FACTOR_DIST = 150 / SCREEN_METERAGE;
var SPAWN_PICKUP_CHANCE = 0.1;
var SPAWN_MONSTER_CHANCE = 0.01;
var SPAWN_RAMP_CHANCE = 0.025;
var RAMP_CRITICAL_SPEED = 15.0;
-var MONSTER_SPAWN_DIST = 5000;
var RAMP_CRITICAL_REDUX = 10;
var RAMP_SPEED_BOOST = 1.25;
var RAMP_SPEED_DURATION = 3.0;
var RAMP_SPEED_HEIGHT = 20.0;
-var DIFFICULTY_FACTOR_DIST = 1000;
;
var Game = Container.expand(function () {
var self = Container.call(this);
var stageWidth = 2048;
@@ -568,18 +571,15 @@
var tileSize = 512;
var playerPosX = Math.round(stageWidth / 2);
var playerPosY = Math.round(stageWidth / 3);
var tileMargin = tileSize;
- var background = self.createAsset('background', 'Fullscreen background', 0, 0);
var landscapeLookup = {};
var landscapeTiles = [];
var pickups = [];
var monsters = [];
var effects = [];
var rampList = [];
var speed = 0;
- background.width = stageWidth;
- background.height = stageHeight;
var interface = LK.gui.topCenter.addChild(new Interface(0, 10));
var trail = self.addChild(new Trail(playerPosX, playerPosY));
var player = self.addChild(new Player(playerPosX, playerPosY));
landscapeTiles.push(landscapeLookup['0:0'] = self.addChild(new LandscapeTile(player.x, player.y, {
@@ -600,8 +600,10 @@
var targetPosition = {
x: playerPosX,
y: playerPosY
};
+ LK.stageContainer.setBackgroundColor(0xFFFFFF);
+ ;
stage.on('down', function (obj) {
isMouseDown = true;
updatePosition(obj.event);
});
@@ -675,8 +677,9 @@
}
}
}
});
+ ;
function updatePosition(event) {
var pos = event.getLocalPosition(self);
targetPosition.x = pos.x;
targetPosition.y = pos.y;
Pixel art of a Santa. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a tree stump covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a dead tree covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a christmas tree covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a spruce tree covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a rock covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a christmas present counter. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a christmas present. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a blue christmas present. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art heart icon . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
two vertical lines with a blank background.
pixel art of a large, snow covered rock . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of skiis . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a floating grinch monster . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
single green firework explosion . Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a wooden board covered in snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a wooden pole with snow at it's base. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
tileable white water texture pixel art.