began working on shard entity
This commit is contained in:
		
							
								
								
									
										67
									
								
								core/src/zero1hd/polyjet/entity/enemies/Shard.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								core/src/zero1hd/polyjet/entity/enemies/Shard.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
package zero1hd.polyjet.entity.enemies;
 | 
			
		||||
 | 
			
		||||
import com.badlogic.gdx.graphics.Texture;
 | 
			
		||||
import com.badlogic.gdx.math.MathUtils;
 | 
			
		||||
import com.badlogic.gdx.math.Rectangle;
 | 
			
		||||
import com.badlogic.gdx.math.Vector2;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.Actor;
 | 
			
		||||
import com.badlogic.gdx.utils.Pool.Poolable;
 | 
			
		||||
 | 
			
		||||
import zero1hd.polyjet.entity.Entities;
 | 
			
		||||
import zero1hd.polyjet.entity.Entity;
 | 
			
		||||
 | 
			
		||||
public class Shard extends Actor implements Entity, Poolable {
 | 
			
		||||
	private Texture shard;
 | 
			
		||||
	private Rectangle hitbox;
 | 
			
		||||
	private Vector2 angle;
 | 
			
		||||
	private int hp;
 | 
			
		||||
	private int maxHp;
 | 
			
		||||
	public Shard(Texture shardTexture) {
 | 
			
		||||
		this.shard = shardTexture;
 | 
			
		||||
		hitbox = new Rectangle();
 | 
			
		||||
		angle = new Vector2();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void init(float x, float y, float angle, float rate, int hp) {
 | 
			
		||||
		this.hp = hp;
 | 
			
		||||
		maxHp = hp;
 | 
			
		||||
		setPosition(x, y);
 | 
			
		||||
		this.angle.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle));
 | 
			
		||||
		setSize(1f, 1f);
 | 
			
		||||
		hitbox.setSize(getWidth(), getHeight());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void reset() {
 | 
			
		||||
		hp = 0;
 | 
			
		||||
		setPosition(0, 0);
 | 
			
		||||
		angle.set(0, 0);
 | 
			
		||||
		setSize(0, 0);
 | 
			
		||||
		maxHp = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void collided(Entity entity) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Rectangle getHitZone() {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Entities getEntityType() {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean isDead() {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user