簡體   English   中英

如何激活scene2d 簡單的moveTo 就可以了?? libgdx

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

如何激活scene2d簡單的移動呢?? libgdx

我的代碼是這樣的,但我想在上面應用 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);

}

做簡單的 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

}

制作 Moveto scene2D 的任何想法 function ????

您正在定義一個無處可去的階段。 要使這個 Stage 工作,您必須將它綁定到 Screen 並調用 act() 和 draw()。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM