minor variable clearup
This commit is contained in:
parent
5d6a01f117
commit
cc8a1f0c22
21
sketch.js
21
sketch.js
@ -1,15 +1,15 @@
|
|||||||
var floorPos_y;
|
var floorPos_y;
|
||||||
var cameraPosX;
|
var cameraPosX;
|
||||||
var camera_speed;
|
var camera_speed;
|
||||||
var processStop_timer;
|
|
||||||
var fps_recent_values = [];
|
var fps_recent_values = [];
|
||||||
var death_timer;
|
|
||||||
var showDebugData = false;
|
var showDebugData = false;
|
||||||
var debug_charTrace = [];
|
var debug_charTrace = [];
|
||||||
var shadows_enabled = true;
|
var shadows_enabled = true;
|
||||||
|
var text_size;
|
||||||
|
// Variables to set colors. Set in setup()
|
||||||
|
var palette;
|
||||||
var gameChar;
|
var gameChar;
|
||||||
|
var flagpole;
|
||||||
var gravity;
|
var gravity;
|
||||||
var game_score;
|
var game_score;
|
||||||
var finish_position_x;
|
var finish_position_x;
|
||||||
@ -21,7 +21,6 @@ var collectables = [];
|
|||||||
var rivers = [];
|
var rivers = [];
|
||||||
var platforms = [];
|
var platforms = [];
|
||||||
var enemies = [];
|
var enemies = [];
|
||||||
var flagpole;
|
|
||||||
|
|
||||||
function GameCharacter() {
|
function GameCharacter() {
|
||||||
this.x = width / 2;
|
this.x = width / 2;
|
||||||
@ -44,6 +43,7 @@ function GameCharacter() {
|
|||||||
this.curGroundIndex = 0;
|
this.curGroundIndex = 0;
|
||||||
this.memorizedPlatform;
|
this.memorizedPlatform;
|
||||||
this.invincibility_time = 0;
|
this.invincibility_time = 0;
|
||||||
|
this.death_timer;
|
||||||
|
|
||||||
this._updateSprite = function () {
|
this._updateSprite = function () {
|
||||||
if (this.isPlummeting) {
|
if (this.isPlummeting) {
|
||||||
@ -274,10 +274,10 @@ function GameCharacter() {
|
|||||||
gameChar.invincibility_time += 180;
|
gameChar.invincibility_time += 180;
|
||||||
};
|
};
|
||||||
this._checkPlayerDie = function () {
|
this._checkPlayerDie = function () {
|
||||||
if (frameCount - death_timer > 60) {
|
if (frameCount - this.death_timer > 60) {
|
||||||
if (this.curLives > 1) {
|
if (this.curLives > 1) {
|
||||||
this.curLives--;
|
this.curLives--;
|
||||||
death_timer = undefined;
|
this.death_timer = undefined;
|
||||||
startGame();
|
startGame();
|
||||||
} else if (this.curLives == 1) {
|
} else if (this.curLives == 1) {
|
||||||
this.curLives--;
|
this.curLives--;
|
||||||
@ -348,7 +348,7 @@ function GameCharacter() {
|
|||||||
if (this.isPlummeting) {
|
if (this.isPlummeting) {
|
||||||
// using OR operator to set to frameCount in case death_timer is undefined,
|
// using OR operator to set to frameCount in case death_timer is undefined,
|
||||||
// but not updating the death_timer again in case it is not undefined.
|
// but not updating the death_timer again in case it is not undefined.
|
||||||
death_timer = death_timer || frameCount;
|
this.death_timer = this.death_timer || frameCount;
|
||||||
this.y += 3;
|
this.y += 3;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -484,11 +484,6 @@ function Enemy(curGroundIndex, x, y, size) {
|
|||||||
this.y = this.y + cos((frameCount / random(10, 20)) * random(0.5, 10));
|
this.y = this.y + cos((frameCount / random(10, 20)) * random(0.5, 10));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var text_size;
|
|
||||||
// Variables to set colors. Set in setup()
|
|
||||||
var palette;
|
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
createCanvas(1024, 576);
|
createCanvas(1024, 576);
|
||||||
palette = {
|
palette = {
|
||||||
|
Loading…
Reference in New Issue
Block a user