【发布时间】:2015-04-17 16:04:05
【问题描述】:
使用LibGdx Animation时如何获取单帧的宽高?
tallAnim = new Animation(1/10f, atlas.findRegion("runner1"), atlas.findRegion("runner2"), atlas.findRegion("runner3"), atlas.findRegion("runner4"));
shortAnim = new Animation(1/10f, atlas.findRegion("short_runner1"), atlas.findRegion("short_runner2"), atlas.findRegion("short_runner3"), atlas.findRegion("short_runner4"));
animation = tallAnim;
我在这两个动画之间切换,当我检查碰撞时,我需要知道当前动画帧的确切宽度/高度。
我通常会如何处理:
public Rectangle getBounds(){
return new Rectangle(positionX, positionY, sprite.getWidth(), sprite.getHeight());
}
【问题讨论】: