11. Filling Out the Cases


#1



Can anyone explain why it's not correct?
Mario is moving properly


$(document).ready(function() {
    $(document).keydown(function(key) {
        switch(parseInt(key.which,10)) {
			// Left arrow key pressed
			case 37:
				$('img').animate({left: "-=10px"}, 'fast');
				break;
			// Up Arrow Pressed
			case 38:
			    $('img').animate({top: "-=10px"}, 'fast');
				// Put our code here
				break;
				// Right Arrow Pressed
			case 39:
			    $('img').animate({left: "+=10px"}, 'fast');
				// Put our code here
				break;
			// Down Arrow Pressed
			case 40:
				// Put our code here
				$('img').animate({top: "+=10px"}, 'fast');
				break;
		}
	});
});

Replace this line with your code.


#2

In the preview did you move up, down, left and right ?


#3

The reason is that you actually have to play it by preessing they keys as you click run.. So do this in sequence.. play run, move with your arrow keys, then press back to editor.. If your code is correct and mario moves properly it should work then.. if it dosent........ reply saying so.


#4

Hei, i've the same problem there. The code is just look like that and when i press the arrow key (right, up and down), it doesn't show the effect. It just show the effect if i press the left key.


#7

2 posts were split to a new topic: 11. Filling Out the Cases


#8