New to jquery! example not working or possibly me:)
HI All - I am trying to create a ping pong game using a book and when I type the code I get a unexpected token {
I am not sure what type of variable i am trying to declare here in order to get the time and the array working. Here is the code sample could some one explain what is supposed to be happening and what is going wrong? Thank you so much !
var pingpong{}
pingpong.pressedKeys =[];
$(function(){
//set interval to call gameloop every 30 milliseconds
pingpong.timer = setInterval(gameloop,30);
//mark what key is up or down into array called "pressedKeys"
$(document).keydown(function(e){
pingpong.pressedKeys[e.which] = true;
});
$(document).keyup(function(e){
pingpong.pressedKeys[e.which] = false;
});
});