如何在 Scene2d 中制作 UI 动画?
How to make UI animation in Scene2d?
我在 libgdx scene2d 中使用 table 为我的分数对标签进行分组:
lblScore = new Label("Score: " + Integer.toString(score), labelStyle);
lblBscore = new Label("Best: " + Integer.toString(bScore), labelStyle);
table = new Table();
table.setFillParent(true);
table.setDebug(false);
table.top();
table.add(lblScore).padTop(Constant.HEIGHT / 2 - 100);
table.row();
table.add(lblBscore).padTop(10);
stage.addActor(table);
我想要发生的是,当我的角色死亡时,table 会以动画形式出现,而且当我的角色还活着时,table 只是隐藏起来也是个好主意?或者我应该在我的角色死后创建 table 吗?
您没有指定要执行的动画类型,但请查看操作 class,因为它有一系列操作可用于为 Scene2d 组件设置动画(移动、颜色变化、淡入淡出) in/out、旋转等):
这是一个带有示例代码的教程,演示了如何使用操作:
http://www.gamefromscratch.com/post/2013/12/09/LibGDX-Tutorial-9-Scene2D-Part-2-Actions.aspx
我在 libgdx scene2d 中使用 table 为我的分数对标签进行分组:
lblScore = new Label("Score: " + Integer.toString(score), labelStyle);
lblBscore = new Label("Best: " + Integer.toString(bScore), labelStyle);
table = new Table();
table.setFillParent(true);
table.setDebug(false);
table.top();
table.add(lblScore).padTop(Constant.HEIGHT / 2 - 100);
table.row();
table.add(lblBscore).padTop(10);
stage.addActor(table);
我想要发生的是,当我的角色死亡时,table 会以动画形式出现,而且当我的角色还活着时,table 只是隐藏起来也是个好主意?或者我应该在我的角色死后创建 table 吗?
您没有指定要执行的动画类型,但请查看操作 class,因为它有一系列操作可用于为 Scene2d 组件设置动画(移动、颜色变化、淡入淡出) in/out、旋转等):
这是一个带有示例代码的教程,演示了如何使用操作:
http://www.gamefromscratch.com/post/2013/12/09/LibGDX-Tutorial-9-Scene2D-Part-2-Actions.aspx