android - render in libgdx can't update the new value to draw -


I just start libgdx and it sounds simple but I do not understand. My render method in the Screen object will call the Renderer method from World Renderer:

  Public World World; Public Zero Render () {spriteBatch.begin (); DrawBlocks (); DrawBob (); SpriteBatch.end (); If (Debug) Doodbub (); } Private zero drawBob () {Bob Bob = this.world.getBob (); Logs. E ("Inside DiscoBob", this.world.getBob (). GetPosition () .x + "Dadas"); BobFrame = Bob. ISAFING Life ()? Bobidele Left: Bobby Wright; If (bob.getState (.) Equals (state. WALKING)) {bobFrame = bob.isFacingLeft ()? WalkLeftAnimation.getKeyFrame (bob.getStateTime (), true): walkRightAnimation.getKeyFrame (bob.getStateTime (), true); } Spritebatch.draw (bobFrame, bob.getPosition () .x * ppuX, bob.getPosition (). Wi * PiPay, Bob. SEJEE * ppuX, Bob. SEJEE * ppi);  

// screen render method

  zero render (float delta) {Gdx.gl.glClearColor (0.1f, 0.1f, 0.1f, 1) ; Gdx.gl.glClear (GL10.GL_COLOR_BUFFER_BIT); Controller.update (delta); Renderer.render (); }  

I have an update button to update the world's Bob status. Here's the administrator's update:

  Public Zune update (float delta) {processInput (); Vector 2 position = new vector 2 (7,7); //bob.setPosition(pos); Bob.getPosition () X + = 1; Bob.update (delta); }  

create the application () method

  create public zoom () {setScreen (new game screen ()); World = new world (); Renderer = new global (world, true); Controller = New World Controller (World); //Gdx.input.setInputProcessor(this); }  

Within the method, I updated it and changed the value. But the position in Bob's render does not change, so I can not move to Bob. Please tell me where is the wrong.

We got the problem after discussing in the chat if you have your ApplicationListener If you override code> render () , you will need to call super.render () , to ensure that render (float delta) In the screen is called pause () and ApplicationListener for other methods.


Comments