2017-12-07 14:00:06 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
console.log("ready");
|
|
|
|
$(document).on('keydown', function(e){
|
|
|
|
if(e.which == 37){
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#move-left").attr('id','char-pants-left');
|
|
|
|
$("#char-arm-left-up").attr('id','char-arm-left');
|
|
|
|
$("#char-arm-right-up").attr('id','char-arm-right');
|
2017-12-07 14:00:06 +01:00
|
|
|
$("#char-container").css({
|
|
|
|
'left': '-=2rem',
|
|
|
|
})
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-pants-left").attr('id','move-left');
|
|
|
|
$("#char-pupil-left").attr('id','char-pupil-left-move');
|
|
|
|
$("#char-pupil-right").attr('id','char-pupil-right-move');
|
|
|
|
$("#char-arm-left").attr('id','char-arm-left-up');
|
|
|
|
$("#char-arm-right").attr('id','char-arm-right-up');
|
2017-12-12 15:28:23 +01:00
|
|
|
}
|
2017-12-07 14:00:06 +01:00
|
|
|
if(e.which == 38){
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-arm-left-up").attr('id','char-arm-left');
|
|
|
|
$("#char-arm-right-up").attr('id','char-arm-right');
|
2017-12-07 14:00:06 +01:00
|
|
|
$("#char-container").css({
|
|
|
|
'top': '-=2rem',
|
|
|
|
})
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-arm-left").attr('id','char-arm-left-up');
|
|
|
|
$("#char-arm-right").attr('id','char-arm-right-up');
|
2017-12-07 14:00:06 +01:00
|
|
|
}
|
|
|
|
if(e.which == 39){
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#move-right").attr('id','char-pants-right');
|
|
|
|
$("#char-arm-left-up").attr('id','char-arm-left');
|
|
|
|
$("#char-arm-right-up").attr('id','char-arm-right');
|
2017-12-07 14:00:06 +01:00
|
|
|
$("#char-container").css({
|
|
|
|
'left': '+=2rem',
|
|
|
|
})
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-pants-right").attr('id','move-right');
|
|
|
|
$("#char-pupil-left-move").attr('id','char-pupil-left');
|
|
|
|
$("#char-pupil-right-move").attr('id','char-pupil-right');
|
|
|
|
$("#char-arm-left").attr('id','char-arm-left-up');
|
|
|
|
$("#char-arm-right").attr('id','char-arm-right-up');
|
2017-12-07 14:00:06 +01:00
|
|
|
}
|
|
|
|
if(e.which == 40){
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-arm-left-up").attr('id','char-arm-left');
|
|
|
|
$("#char-arm-right-up").attr('id','char-arm-right');
|
2017-12-07 14:00:06 +01:00
|
|
|
$("#char-container").css({
|
|
|
|
'top': '+=2rem',
|
|
|
|
})
|
2017-12-12 17:54:44 +01:00
|
|
|
$("#char-arm-left").attr('id','char-arm-left-up');
|
|
|
|
$("#char-arm-right").attr('id','char-arm-right-up');
|
2017-12-07 14:00:06 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|