Make objects slide across the screen in random positions
- by user3475907
I want to make an object appear randomly at the right hand side of the screen and then slide across the screen and disapear at the left hand side. I am working with libgdx. I have this bit of code but it makes items fall from the top down. Please help.
public EntityManager(int amount, OrthoCamera camera) {
player = new Player(new Vector2(15, 230), new Vector2(0, 0), this, camera);
for (int i = 0; i < amount; i++) {
float x = MathUtils.random(0, MainGame.HEIGHT - TextureManager.ENEMY.getHeight());
float y = MathUtils.random(MainGame.WIDTH, MainGame.WIDTH * 10);
float speed = MathUtils.random(2, 10);
addEntity(new Enemy(new Vector2(x, y), new Vector2(-0, -speed)));
}