1
타일 기반 게임을 시도하고 생성하려면 .animate를 사용하고 있습니다. 나는이 작업을 시도하고 만들기 위해 다른 아약스 스크립트와 jQuery를 혼합했다. 나는 움직이기 위해 화살표를 계속 클릭하지만 아무 결과도 얻지 못합니다. 어쩌면 다른 누군가가 그 이유를 이해할 수 있을까요?jQuery .animate() 실행하지 않습니다
버튼 :
$data .= "<center><table><tr><td></td><td><button onclick=\"transition(\'up\')\">↑</button></td> <td></td></tr><tr><td><button onclick=\"transition(\'left\')\">←</button></td> <td></td> <td><button onclick=\"transition(\'right\')\">→</button></td></tr><tr><td></td> <td><button onclick=\"transition(\'down\')\">↓</button></td> <td></td></tr></table></center>";
지도 : 마지막으로
$data .= "<div style=\'width:480px;height:480px;background-color:#000000;background-image:url(".$map['background'].");padding:".$map['locationpadding'].";\' id=\'locationMap\'>";
$data .= "<div id=\'specialLocations\'></div>";
$data .= "<div style=\'position:absolute;left:".$charrel[0]."px;bottom:".$charrel[1]."px;width:32px;height:32px;background-image:url(".$char['charimage'].");\' id=\'charLocation\'></div>";
$data .= "</div>";
, 애니메이션을 받고. if 문이 모두 작동하는지 확인했습니다. 그래서 지금까지 모든 것이 잘 작동합니다.
if($_POST['direction'] == "up"){
print("$('#charLocation').animate({'bottom': '+=50px'}, 'slow');");
}elseif($_POST['direction'] == "left"){
print("$('#charLocation').animate({'left': '-=50px'}, 'slow');");
}elseif($_POST['direction'] == "right"){
print("$('#charLocation').animate({'left': '+=50px'}, 'slow');");
}elseif($_POST['direction'] == "down"){
print("$('#charLocation').animate({'bottom': '-=50px'}, 'slow');");
}else{
die('alert("Invalid movement.");');
}
그리고 PHP를 통해 jQuery를/자바 스크립트 코드를 인쇄하기위한 추론
모든 것이 내가 결코 인쇄하지하고 Ajax 코드를 통해로드 된 것입니다.미리 혼란스러워서 죄송합니다.
데이터가 부족합니다. 함수 이름이 "다른 ajax 스크립트"와 충돌하거나 jQuery 코드 주위에'