2014-05-08 1 views
0

는 여기이 자습서를 따라 한 - 나는 간단한 젤다 스타일의 RPG 게임을 만들려고 노력하고 있지만 튜토리얼에 동적 배경을 사용 http://www.stormation.info/rpg-game-creation-tutorial/플래시 (AS2)에서 문자 충돌이있는 PNG 이미지 .... 방법?

. 캐릭터가 걸을 수있는 투명한 영역이있는 PNG 이미지를 사용하고 싶습니다. 이처럼

는 : http://www.imagebam.com/image/de39a1325517813

http://www.imagebam.com/image/5e22e6325517815

http://www.imagebam.com/image/753d56325517819

나는 문자를 차단하기 위해 투명한 영역에서 떨어져 모든 것을 할 수 있습니다. 이것이 가능한가?

이 튜토리얼에는 충돌 감지 기능이 있지만 png를 무비 클립으로 만들면 코드와 일치하는 인스턴스 '벽'을 사용하여 장면을 테스트 할 때 내 캐릭터가 사라집니다. 여기

내 현재 AS2 코드 :

onClipEvent(load){ 
     radius = 6 
     for (stop in this) { 
        this[stop].stop() 
     } 
} 

onClipEvent(enterFrame){ 
     if(Key.isDown(Key.UP)){ 
        this._y -= speed 
        facing = "up" 
     } 
     if(Key.isDown(Key.DOWN)){ 
        this._y += speed 
        facing = "down" 
     } 
     if(Key.isDown(Key.RIGHT)){ 
        this._x += speed 
        facing = "right" 
     } 
     if(Key.isDown(Key.LEFT)){ 
        this._x -= speed 
        facing = "left" 
     } 
     if(Key.isDown(Key.SHIFT)){ 
        speed = 5 
        state = "run" 
     }else{ 
        speed = 3 
        state = "walk" 
     } 
     if(!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.UP) && !Key.isDown(Key.DOWN)){ 
        this[facing].gotoAndStop(1) 
     }else{ 
        this[facing].play() 
     } 
     while(_root.walls.hitTest(_x, _y+radius/2, true)){ 
        _y--; 
     } 
     while(_root.walls.hitTest(_x, _y-radius, true)){ 
        _y++; 
     } 
     while(_root.walls.hitTest(_x-radius, _y, true)){ 
        _x++; 
     } 
     while(_root.walls.hitTest(_x+radius, _y, true)){ 
        _x--; 
     } 
     gotoAndStop(state+facing) 
     depthControl() 
} 

답변

0
그러나 hitTest는 바로 병에서 비트 맵에 알파를 인식 할 수없는, 그러나 나는 이것에 대한 해결책은 만약을 마련하는 것은 불가능하다 생각하지 않는다

BitmapData 클래스와 함께 팅커. 더 쉬운 (그러나 덜 우아한) 방법은 플레이어가 갈 수없는 곳에 채울 수있는 무적의 레이어를 사용하는 것이며, png가 포함 된 클립 대신에 hitTest를 사용하는 것입니다.