Skip to content

code variables(and constants)

JonathanSteininger edited this page Nov 3, 2019 · 2 revisions

variables:

    var playerName = '';
    var difficulty = '';

    var gameStop = true;
    var gamePause = false;

    var gamePauseBackground = 0;
    var gameEndBackground = 0;
    var gameMenuBackground = 0;
    
    var scoreScreen = false;
    
    var restart;
    
    //playerdata
    var playerXpos;
    var playerYpos;
    var playerSize;
    var playerYspeed;
    var playerXspeed;
    var playerColor';
    
    var playerStartPos;
    var onetimer = true;
    //megaphone data
    var megaphoneXpos;
    var megaphoneYpos];
    var megaphoneSize;
    // all the key codes
    const UP_KEY  ;
    const DOWN_KEY ;
    const LEFT_KEY;
    const RIGHT_KEY;
    const RESTART_KEY;
    const UP_ARROW_KEY;
    const DOWN_ARROW_KEY;
    const LEFT_ARROW_KEY;
    const RIGHT_ARROW_KEY;
    const ENTER_KEY;
    const PAUSE_KEY;
    var upKeyPressed = false;
    var downKeyPressed = false;
    var leftKeyPressed = false;
    var rightKeyPressed = false;
    var pauseKeyPressed = false;
    var restartKeyPressed = false;
    var enterKeyPressed = false;
    //pause menu configuration
    var singlePress = true;
    var pauseChanger;
    //game stats
    var Invincability;
    var lives;
    var score;
    var scoreIntervals;
    var maxBullets;
    
    var img = new Image();   // Create new img element
    var singleLoadImg = true;
    //background img
    var backgroundImg = new Image();   // Create new img element
    backgroundImg.src = ""
    //player img
    
    var bloonImg = new Image();
    bloonImg.src = ""
    
    var bloonImg2 = new Image();
    bloonImg2.src = ""
    
    var bloonImg3 = new Image();
    bloonImg3.src = ""
    //bullet img
    var bulletImg = new Image();
    bulletImg.src = ""
    
    var megaphoneImg = new Image();
    megaphoneImg.src = ""
    //rope img
    var imgRope = new Image();
    imgRope.src = ""
    var ropeSize;
    var ropePos;
    
    var playerColour = bloonImg;

    var bullets = [];
Clone this wiki locally