Created
October 16, 2017 09:44
-
-
Save sparkica/1bfbfdce459a8aca000f678aa6f4e59b to your computer and use it in GitHub Desktop.
Beginning game development with LibGDX - moving an image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float posX = 0; | |
@Override | |
public void render() { | |
Gdx.gl.glClearColor(1, 0, 0, 1); | |
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); | |
batch.begin(); | |
batch.draw(img, posX, 0); | |
batch.end(); | |
// The time it took to render the last frame on screen | |
float delta = Gdx.graphics.getDeltaTime(); | |
float speed = 100; | |
posX += delta * speed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment