Android : My Sprites seem to be spawning from left to right of the screen?

on Friday, July 11, 2014


So, my issue is that my sprites seem to be spawning from the left of the screen to the right of the screen (I'm using a samsung s3 to test my app). They should be coming down from the top of the screen. I'm using Libgdx and I know 0 starts at the bottom left.


Here's my code to set where they should start..



ublic class EntityManager {

private final Array<Entity> entities = new Array<Entity>();



public EntityManager(int amount){

for(int i = 0; i< amount; i++) {
float x = MathUtils.random (0, MainGame.WIDTH - TextureManager.ENEMY.getWidth());
float y = MathUtils.random(MainGame.HEIGHT, MainGame.HEIGHT * 2);
float speed = MathUtils.random(2, 5);
addEntity(new Enemy(new Vector2 (x, y), new Vector2(0, - speed)));


Here is my MainGame Class...(well the top half of it)



public class MainGame implements ApplicationListener {
public static int WIDTH = 480, HEIGHT = 800;
private SpriteBatch batch;


Thank you in advance.


0 comments:

Post a Comment