LibGdx, objects dont move

Im creating 32 object with each method call, and they should move in different directions, but what is happening is that they spawn, but wont move. What might be the issue here?


class that handles all the objects in the world
public void update(float delta){
		runTime += delta;
	    player.update(delta);
	    for(Enemy e: enemy){
	    	e.update(delta);
	    }
	    
	    for(CircleBullet b: bullets){
	    	b.update(delta);
	    }
	    if(runTime > 0.25){
	    	enemy.add(new Enemy1(0,GameConstants.GAMEHEIGHT-12,12,12, new Vector2(90,-200),new Vector2(0,150), 1));
	    	enemy.add(new Enemy1(GameConstants.GAMEWIDTH-12,GameConstants.GAMEHEIGHT-12,12,12,
	    			new Vector2(-90,-200),new Vector2(0,150), -1));
	    	runTime = 0;
	    }
	}

The class that creates the 32 bullets.
public class shot {
	private Vector2 position;
	private ArrayList<CircleBullet> bullets = new ArrayList<CircleBullet>();
	private Vector2 velocity;
	
	public shot(float x, float y){
		velocity = new Vector2(0,5);
		position = new Vector2(x,y);
		for(int i = 0; i<32; i++){
			velocity.setAngle(i*11.25f);
			GameWorld.bullets.add(new CircleBullet(position, velocity.x, velocity.y));
		}
	}
	
	public void update(float delta){
		for(CircleBullet b: bullets){
			b.update(delta);
		}
	}
	
	public float getX(){
		return position.x;
	}
	
	public float getY(){
		return position.y;
	}
	
	public ArrayList<CircleBullet> getBullets(){
		return bullets;
	}
}

CircleBullet class
public class CircleBullet {
	private Vector2 position;
	private Vector2 velocity;
	
	public CircleBullet(Vector2 position, float vx, float vy){
		this.position = position;
		this.velocity = new Vector2(vx, vy);
	}
	
	public void update(float delta){
		position.add(velocity.cpy().scl(delta));

	}
	
	public float getX(){
		return position.x;
	}
	
	public float getY(){
		return position.y;
	}
}

Can you post an MCVE instead of an incomplete code snippet? Not your whole project, just enough for us to be able to run the code and see the problem.

So this is the minimal code needed. http://pastebin.java-gaming.org/8e3de6e040a1a if you want to move the character around then most of the stuff remains, just the touchpad needs to be re-inserted(remove comment marks, and in player class add touchpad to constructor).

This is cut version of the code. And i used libGdx to create this.

Hi

Do you ever call the method update() for your world? I didn’t see anything in the code sample but I may have missed something.

CopyableCougar4

Its in the screen class. Screen class serves basicly as the game loop

I fount out that the problem lies within the shot class.
When i create CircleBullet separately then it works fine, but when i use the shot class, it doesent move anymore.
What might cause this problem? This Class seems ok to me.

public class shot {
	private Vector2 position;
	private ArrayList<CircleBullet> bullets = new ArrayList<CircleBullet>();
	private Vector2 velocity;
	
	public shot(float x, float y){
		velocity = new Vector2(0,50);
		position = new Vector2(x,y);
		for(int i = 0; i<32; i++){
			velocity.rotate(i*11.25f);
			bullets.add(new CircleBullet(position, velocity.x, velocity.y));
		}
	}
	
	public void update(float delta){
		for(CircleBullet b: bullets){
			b.update(delta);
		}
	}
	
	public float getX(){
		return position.x;
	}
	
	public float getY(){
		return position.y;
	}
	
	public ArrayList<CircleBullet> getBullets(){
		return bullets;
	}
}

Fixed it. Somewhere along the line of getting the info to update bullet positions, update method wasnt called.