현재 AS3의 멋진 2D 게임 엔진에서 작업 중입니다. 다른 애니메이션의 XML을 통해 다른 플래시 무비 클립으로로드 할 수도 있습니다. 기능 중 하나를 사용하면 특정 동작을 수행 할 때 애니메이션을 넘길 수 있습니다. 그런 식으로 평소와 같이 좌우로 1 개의 애니메이션을 만들 수 있습니다. 올바르게 작동하는 행렬 변환이 있습니다. 그러나, 나는 앞뒤로 물건을 뒤집기위한 나의 논리가 잘못되었다고 생각한다. 결과적으로 잘못된 애니메이션이 잘못된 시간에 재생됩니다. 필자는 물리 요소가 관련되어 있기 때문에 키 누르기보다는 움직이는 물체의 속도를 기반으로 애니메이션을 재생하기로 결정했습니다. http://parrisstudios.com/Game_Design/gameEngineDemo/MovieClip을 뒤집기위한 결함있는 매트릭스
문제는 애니메이션이 잘못된 시간에 재생하거나 할 때 그들이해야 재생되지 않는 것이 주로 다음과 같습니다
은 현재 상태에서 게임에 대한 링크입니다.여기 내 의견을 대변하는 코드입니다 (여러분이 생각하는 것을 알려주세요). ps : 방향 변수는 문자가 마주 보는 마지막 방향입니다 (이 경우 왼쪽 또는 오른쪽으로 코드의 뒷 부분에서 설명합니다).)
private function drawJumpMode():void {
var change:Boolean = false;
//decide whether to swap graphics or continue playing
if (Math.abs(particleGroup.particles[0].velocity.y) < epsilon && Math.abs(particleGroup.particles[0].velocity.x) < epsilon && direction == "right") {
if (lastClipAction != "stillRight"){
lastClipAction = "stillRight";
change = true;
}
}
else if (Math.abs(particleGroup.particles[0].velocity.y) < epsilon && Math.abs(particleGroup.particles[0].velocity.x) < epsilon && direction == "left") {
if (lastClipAction != "stillLeft"){
lastClipAction = "stillLeft";
change = true;
}
}
else if (particleGroup.particles[0].velocity.y > 0 && Math.abs(particleGroup.particles[0].velocity.x) < epsilon) {
if (lastClipAction != "down"){
lastClipAction = "down";
change = true;
}
}
else if (particleGroup.particles[0].velocity.y < 0 && Math.abs(particleGroup.particles[0].velocity.x) < epsilon) {
if (lastClipAction != "up"){
lastClipAction = "up";
change = true;
}
}
else if (particleGroup.particles[0].velocity.x > 0) {
if (lastClipAction != "right") {
lastClipAction = "right";
direction = "right";
change = true;
}
}
else if (particleGroup.particles[0].velocity.x < 0) {
if (lastClipAction != "left"){
lastClipAction = "left";
direction = "left";
change = true;
}
}
//If the movie clip has changed, swap the old one back into the all clips library and get the new one.
if (change) {
//set flip to false whenever there is a change in movie clip
flipped = false;
//if the movie clip was flipped before, this should flip it
//back to normal
flip();
//remove movie clip from the scene
game.removeChild(playingMovieClip);
//check it back into the movie clip library
allClips.addChild(playingMovieClip);
//add the movie clip into the scene
playingMovieClip = MovieClip(allClips.getChildByName(actionToClip[lastClipAction + "Name"]));
game.addChild(playingMovieClip);
}
//Flip if needed
flip();
//set it to true so that it won't be constantly flipped.
flipped = true;
//set movie clip to be center over the main particle
playingMovieClip.x = particleGroup.particles[0].center.x;
playingMovieClip.y = particleGroup.particles[0].center.y;
}
private function flip():void {
//If a transformation is required, then do so
if (actionToClip[lastClipAction + "H"]=="1" && !flipped){
flipHorizontal(playingMovieClip);
}
if (actionToClip[lastClipAction + "V"]=="1" && !flipped){
flipVertical(playingMovieClip);
}
}
무엇이 잘못 되었나요? 당신은 무엇을 볼 것으로 예상합니까? 그리고 당신은 무엇을 대신 보입니까? 최대한 구체적으로 작성하십시오. – Amber
그래, 나는 그것이 분명하지 않을 것으로 생각합니다. 나는 모든 애니메이션이 내가 예상 한대로 정확하게 움직이는 것을 볼 때를 제외하고는 예외이다. 다음은 링크입니다 : http://parrisstudios.com/Game_Design/gameEngineDemo/ 본질적으로 때로는 이미지가 표시되지 않아야하거나 특정 애니메이션이 실행될 때 트리거되지 않는 경우 이미지가 뒤집어지는 경우가 있습니다. – Parris