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 cameraPosX;
|
||||
var camera_speed;
|
||||
var processStop_timer;
|
||||
var fps_recent_values = [];
|
||||
var death_timer;
|
||||
var showDebugData = false;
|
||||
var debug_charTrace = [];
|
||||
var shadows_enabled = true;
|
||||
|
||||
var text_size;
|
||||
// Variables to set colors. Set in setup()
|
||||
var palette;
|
||||
var gameChar;
|
||||
|
||||
var flagpole;
|
||||
var gravity;
|
||||
var game_score;
|
||||
var finish_position_x;
|
||||
@ -21,7 +21,6 @@ var collectables = [];
|
||||
var rivers = [];
|
||||
var platforms = [];
|
||||
var enemies = [];
|
||||
var flagpole;
|
||||
|
||||
function GameCharacter() {
|
||||
this.x = width / 2;
|
||||
@ -44,6 +43,7 @@ function GameCharacter() {
|
||||
this.curGroundIndex = 0;
|
||||
this.memorizedPlatform;
|
||||
this.invincibility_time = 0;
|
||||
this.death_timer;
|
||||
|
||||
this._updateSprite = function () {
|
||||
if (this.isPlummeting) {
|
||||
@ -274,10 +274,10 @@ function GameCharacter() {
|
||||
gameChar.invincibility_time += 180;
|
||||
};
|
||||
this._checkPlayerDie = function () {
|
||||
if (frameCount - death_timer > 60) {
|
||||
if (frameCount - this.death_timer > 60) {
|
||||
if (this.curLives > 1) {
|
||||
this.curLives--;
|
||||
death_timer = undefined;
|
||||
this.death_timer = undefined;
|
||||
startGame();
|
||||
} else if (this.curLives == 1) {
|
||||
this.curLives--;
|
||||
@ -348,7 +348,7 @@ function GameCharacter() {
|
||||
if (this.isPlummeting) {
|
||||
// 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.
|
||||
death_timer = death_timer || frameCount;
|
||||
this.death_timer = this.death_timer || frameCount;
|
||||
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));
|
||||
};
|
||||
}
|
||||
|
||||
var text_size;
|
||||
// Variables to set colors. Set in setup()
|
||||
var palette;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1024, 576);
|
||||
palette = {
|
||||
|
Loading…
Reference in New Issue
Block a user