|
@@ -286,6 +286,8 @@
|
|
|
* definition.
|
|
|
*/
|
|
|
loadImages: function () {
|
|
|
+ Sun.imageSprite = document.getElementById('sun');
|
|
|
+
|
|
|
if (IS_HIDPI) {
|
|
|
Runner.imageSprite = document.getElementById('offline-resources-2x');
|
|
|
this.spriteDef = Runner.spriteDefinition.HDPI;
|
|
@@ -2099,6 +2101,30 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ function Sun(canvas) {
|
|
|
+ this.canvas = canvas;
|
|
|
+ this.canvasCtx = this.canvas.getContext('2d');
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+
|
|
|
+ Sun.config = {
|
|
|
+ X_POS: 120,
|
|
|
+ Y_POS: 15,
|
|
|
+ };
|
|
|
+
|
|
|
+ Sun.prototype = {
|
|
|
+ init: function() {
|
|
|
+ this.draw();
|
|
|
+ },
|
|
|
+
|
|
|
+ draw: function() {
|
|
|
+ this.canvasCtx.drawImage(Sun.imageSprite, Sun.config.X_POS, Sun.config.Y_POS);
|
|
|
+ },
|
|
|
+
|
|
|
+ update: function() {
|
|
|
+ this.draw();
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
@@ -2536,6 +2562,7 @@
|
|
|
this.horizonLine = new HorizonLine(this.canvas, this.spritePos.HORIZON);
|
|
|
this.nightMode = new NightMode(this.canvas, this.spritePos.MOON,
|
|
|
this.dimensions.WIDTH);
|
|
|
+ this.sun = new Sun(this.canvas);
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -2547,6 +2574,7 @@
|
|
|
* @param {boolean} showNightMode Night mode activated.
|
|
|
*/
|
|
|
update: function (deltaTime, currentSpeed, updateObstacles, showNightMode) {
|
|
|
+ this.sun.update();
|
|
|
this.runningTime += deltaTime;
|
|
|
this.horizonLine.update(deltaTime, currentSpeed);
|
|
|
this.nightMode.update(showNightMode);
|
|
@@ -2555,6 +2583,7 @@
|
|
|
if (updateObstacles) {
|
|
|
this.updateObstacles(deltaTime, currentSpeed);
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/**
|