var player = createObjectPic("playerPic.bmp"); player.addFrames("playerPic2.bmp"); //This is a regular variable that just counts. Thats it, its going to count up forever. var frame = 0; //Setup function setup(){ frame = 0; //Starts the frame counter at 0... because that just makes good sense for the start number. } //Main Game function engine(){ ctx.fillStyle = 'black'; ctx.fillRect(0,0,w,h); frame = frame + 1; //Makes the frame actually count, otherwise it would stay at zero forever. if(frame == 10){ //After 10 screen draws this will trigger and the characters with say things\ player.say("This story is subpar"); }else if(frame == 30){ player.speedx = 5; player.say("Now it is time to move to the right."); }else if(frame == 100){ player.say("Like I said, this story is sub par."); } Remember! When using IF statements always use == and not = A single equal sign ASSIGNS a value, a double equal compares two values.. theres a difference. } //Mouse Click function onClick(){ } //Key presses function keyPress(key){ //To get key number codes console.log(key); /* UP 38 DOWN 40 LEFT 37 RIGHT 39 */ }