简体   繁体   English

如何激活scene2d 简单的moveTo 就可以了?? libgdx

[英]How to active scene2d simple moveTo on it?? libgdx

How to active scene2d simple move on it??如何激活scene2d简单的移动呢?? libgdx libgdx

My code like this, but I want to apply scene2d simple moveto code on it我的代码是这样的,但我想在上面应用 scene2d 简单的 moveto 代码

public Mario(World world, PlayScreen screen){
    super(screen.getAtlas().findRegion("little_mario"));

    this.world = world;
    defineMario();
    marioStand = new TextureRegion(getTexture(),0,11,16,16);
    setBounds(0,0,16/ MarioBros.PPM, 16 / MarioBros.PPM);
    setRegion(marioStand);

}

Doing simple moveto feature做简单的 moveto 功能

public Mario(World world, PlayScreen screen){
    super(screen.getAtlas().findRegion("little_mario"));

    this.world = world;
    defineMario();
    marioStand = new TextureRegion(getTexture(),0,11,16,16);
    setBounds(0,0,16/ MarioBros.PPM, 16 / MarioBros.PPM);
    setRegion(marioStand);

    stage = new Stage(); 
    stage.addActor(this);//Error

    this.addAction(Actions.sequence(Actions.moveTo(500,500,0.5f)));//Not Work

}

Anyidea to make Moveto scene2D function????制作 Moveto scene2D 的任何想法 function ????

You are defining a Stage that is nowhere.您正在定义一个无处可去的阶段。 For this Stage to work, you must tie it to a Screen and call act() and draw().要使这个 Stage 工作,您必须将它绑定到 Screen 并调用 act() 和 draw()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM