Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

@Override public void render() { //Game Loop Gdx.gl.glClearColor(0.7f, 0.7f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); bug.rotate(0); bug.setPosition( 10, 10); bug.draw(spriteBatch); chest.draw(spriteBatch); spriteBatch.end(); } How can i make this bug on my code move around ? how can i implement a timer into this method

OpenStudy (theeric):

Hi! I don't know the overall workings of this game class or engine, but it looks like you can modify the arguments to the `bug.setPosition(10, 10);` statement. You will want to be able to tell it what to do next, so you'll probably want to consider introducing a global variable or using the value of an existing global variable. Alternatively, you can pass a parameter to the `render ()` function. I would suggest passing by a constant reference to access the value quickly and assure that you don't change it. Of course, if you want to change the value in `render ()`, then leave off the const. I suggest leaving it as a constant reference if you go that route, just because "render" doesn't seem to imply changing the environment. It's always a good idea to make sure the name suits the function and vice versa! To alter this variable, you might want to take advantage of any update function that you might have in your class.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!