package space;

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.jln.ld.GameEntity;
import com.jln.ld.Shared;

import menus.GameMenu;

public class Planet{

	private float x; 
	private float y;
	private float speed;
	private TextureRegion region;
	
	public Planet(){
		this.initPlanet();
	}
	
	private void initPlanet(){
		this.y = (float)(Math.random()*Shared.GAME_HEIGHT);
		this.x = (float)(Math.random()*Shared.GAME_WIDTH)+Shared.GAME_WIDTH;
		this.region = Shared.PLANET[(int)(Math.random()*2)][(int)(Math.random()*2)];
		
		this.speed = (float)(Math.random()*0.5)+0.5f;
	}
	
	public void update() {
		this.x -= speed;
		if(x < -96){
			this.initPlanet();
		}
		
	}

	public void render() {
		if(x < Shared.GAME_WIDTH+96){
			Shared.GAME_BATCH.draw(region, (int)((x-48)+Shared.DECAL_X), (int)((y-48)+Shared.DECAL_Y));
		}
		
	}

}
