2
나는 Haxe와 box2d를 사용하여 작은 게임을 개발 중이다. 플레이어가 특정 객체와 접촉하는 동안 구체 인 플레이어 몸체를 재조정합니다. 그러나 몸의 크기를 조절할 때 이미지의 크기를 조정하려고합니다.Haxe에서 스프라이트 이미지 크기를 조정 하시겠습니까?
public function new(w:Int, x:Int, y:Int)
{
super();
this.w = w;
this.x = x;
this.y = y;
var imgSprite = new Sprite();
imgSprite.addChild(new Bitmap(Assets.getBitmapData("img/ball.png")));
imgSprite.x = -w;
imgSprite.y = -w;
this.addChild(imgSprite);
this.alpha = .5;
contactList = new Array<B2Body>();
makeBody(w, x, y, 0);
}
public function resize(w:Int, x:Int, y:Int)
{
var tempAngle = this.body.getAngle();
Main.World.destroyBody(this.body);
makeBody(w, x, y, tempAngle);
}
쉽게 이미지의 크기를 조절할 수있는 기능은 없습니다. 본문과 함께 비트 맵을 스케일하는 방법은 무엇입니까?
http://stackoverflow.com/questions/16273440/haxe-nme-resizing-a-bitmap/16274055#16274055 – W55tKQbuRu28Q4xv
그 코드를 사용하여 시도했지만,이 프로그램은 단순히 오류를 잡아 크기를 조정하려고 할 때 . 문제는 source.bitmapData와 관련이 있다고 생각합니다. 새로운 비트 맵 (Assets.getBitmapData ("img/Glob.png"))으로 대체했습니다. – user1989292