時,這是我的jsfiddle:http://jsfiddle.net/yKvuK/6/怪異的行爲動畫人條紋
if (keydown.right) {
characterImg.src = 'http://pixenate.com/pixenate//cache/photo_e2094a30725ccd74a6d889648d34343b.jpg';
character.CurentPos++;
character.x += character.speed;
if (character.x > CanvasWidth - character.width) { // make the character keep walking even if he step outside the canvas
character.x = 0;
}
}
if (keydown.up) {
characterImg.src = "http://pixenate.com/pixenate//cache/photo_1_5ef90294cd2afeb4486dedd663cfd872.jpg";
character.y -= character.speed;
if (character.y < 0) {
character.y = 0;
}
character.CurentPos++;
}
if (keydown.down) { //going down
characterImg.src = "http://pixenate.com/pixenate//cache/photo_1_ff6712ddd80b138f1865eb4937622d1b.jpg";
character.CurentPos++;
character.y += character.speed;
if (character.y > CanvasHeight - character.height) {
character.y = CanvasHeight - character.height;
}
}
試圖拉昇的字符和下誰能幫助我,當你可以看到這個問題?
你是什麼意思修復png格式它已經是一個PNG圖像 – Sora
@Sora,編輯答案見「編輯」 – Sergio
但它已經在jsfiddle中,如果您發現@Sergio – Sora