/// <summary> /// Construct the laser /// </summary> /// <param name="sprite">The sprite to render</param> /// <param name="startVelocity">The initial velocity of the laser</param> public Laser(SpriteSheet.Sprite sprite, float startVelocity) : base((SpriteSheet.Sprite)sprite) { Velocity = startVelocity; doDraw = false; doUpdate = false; canFire = true; }
/// <summary> /// Construct the asteroid /// </summary> /// <param name="sprite">The sprite to render</param> /// <param name="startPosition">The initial position of the asteroid</param> /// <param name="startDirection">The initial direction of the asteroid</param> /// <param name="startVelocity">The initial velocity of the asteroid</param> /// <param name="turnRate">The turn rate of the asteroid</param> public Asteroid(SpriteSheet.Sprite sprite, Vector2 startPosition, float startDirection, float startVelocity, float turnRate = 1) : base((SpriteSheet.Sprite)sprite, startPosition, startDirection) { Velocity = startVelocity; clockwiseTurnRate = turnRate; doUpdate = true; Alive = true; }
/// <summary> /// Set the entity's sprite /// </summary> /// <param name="sprite"></param> public void SetSprite(SpriteSheet.Sprite sprite) { Sprite = sprite; SpriteRectangle = World.spriteSheet.GetSpriteRectangle(Sprite); collisionRectangle = World.spriteSheet.GetSpriteCollisionRectanlge(Sprite); collisionPoints = World.spriteSheet.GetSpriteCollisionPoints(Sprite); size = new Vector2(SpriteRectangle.Width, SpriteRectangle.Height); offset = new Vector2(SpriteRectangle.Width / 2, SpriteRectangle.Height / 2); }
/// <summary> /// Constructs an entity /// </summary> /// <param name="sprite">The sprite to render</param> /// <param name="startPosition">The initial position of the entity</param> /// <param name="startDirection">The initial direction of the entity</param> public Entity(SpriteSheet.Sprite sprite, Vector2 startPosition, float startDirection) { position = startPosition; drawPosition = position; startPosition = position; direction = startDirection; Sprite = sprite; Scale = 1; SpriteRectangle = World.spriteSheet.GetSpriteRectangle(Sprite); collisionRectangle = World.spriteSheet.GetSpriteCollisionRectanlge(Sprite); collisionPoints = World.spriteSheet.GetSpriteCollisionPoints(Sprite); size = new Vector2(SpriteRectangle.Width, SpriteRectangle.Height); offset = new Vector2(SpriteRectangle.Width / 2, SpriteRectangle.Height / 2); }
/// <summary> /// Constuct the entity with its initial sprite /// </summary> /// <param name="sprite">The sprite to render</param> public Entity(SpriteSheet.Sprite sprite) { position = Vector2.Zero; startPosition = Vector2.Zero; drawPosition = Vector2.Zero; direction = 0; Sprite = sprite; Scale = 1; collisionRectangle = new Rectangle(); SpriteRectangle = World.spriteSheet.GetSpriteRectangle(Sprite); collisionRectangle = World.spriteSheet.GetSpriteCollisionRectanlge(Sprite); collisionPoints = World.spriteSheet.GetSpriteCollisionPoints(Sprite); size = new Vector2(SpriteRectangle.Width, SpriteRectangle.Height); offset = new Vector2(SpriteRectangle.Width / 2, SpriteRectangle.Height / 2); }
/// <summary> /// Construct the enemy /// </summary> /// <param name="sprite">The sprite to render</param> /// <param name="startPos">The initial position of the enemy</param> /// <param name="followPlayer">If the enemy should follow the player</param> /// <param name="health">The maximum health of the player</param> /// <param name="velocity">The maximum velocity of the player</param> public Enemy(SpriteSheet.Sprite sprite, Vector2 startPos, bool followPlayer, int health, float velocity) : base(sprite, startPos, 0) { FollowingPlayer = FollowPlayer = followPlayer; Explosions = new Explosion[2]; for (int i = 0; i < Explosions.Length; i++) { Explosions[i] = new Explosion(SpriteSheet.ExplosionSprites); } Lasers = new Laser[10]; for (int i = 0; i < Lasers.Length; i++) { Lasers[i] = new Laser(SpriteSheet.Sprite.LaserRed, 6f); } Health = health; doUpdate = true; Velocity = velocity; PlayerDirection = 0; Alive = true; rotatedRectangle = new RotatedRectangle(CollisionRectangle, MathHelper.ToRadians(drawDirection)); }
/// <summary> /// Construct the player health entity /// </summary> /// <param name="sprite">The sprite to render to the screen</param> /// <param name="id">The id to give the player health</param> /// <param name="startPos">The start position of the player health</param> public PlayerHealth(SpriteSheet.Sprite sprite, int id, Vector2 startPos) : base(sprite, startPos, 0) { ID = id; }
/// <summary> /// Construct the star /// </summary> /// <param name="sprite">The sprite to render</param> /// <param name="startPosition">The position to render the star to</param> public Star(SpriteSheet.Sprite sprite, Vector2 startPosition) : base(sprite, startPosition, 0) { }
public Ship(SpriteSheet.Sprite sprite) : base(sprite) { }