/// <summary> /// Bullet /// </summary> /// <param name="game"></param> /// <param name="position">spawn position</param> /// <param name="speed">bullet speed</param> /// <param name="Damage">damage of the bullet</param> public Bullets(Skyraha bullet, Vector2 position, int speed, float Damage, Ship Owner) : base(bullet) { bullet.Components.Add(this); this.Damage = Damage; this.Owner = Owner; this.speed = speed; this.Texture = new AdvTexture( bullet.Content.Load <Texture2D>("Schuss2"), new Vector2(64), 18, 25); this.Texture.AnimationSequences.Add("Charge", new int[7] { 0, 1, 2, 3, 4, 5, 6 }); this.Texture.AnimationSequences.Add("Pulse", new int[8] { 7, 8, 9, 10, 11, 12, 13, 14 }); this.Texture.AnimationSequences.Add("Kill", new int[3] { 15, 16, 17 }); this.Texture.Play(false, "Charge"); this.Position = position - (new Vector2(Texture.Width, Texture.Height) * Damage) / 2; }
/// <summary> /// Enemy Constructor /// </summary> /// <param name="game"></param> /// <param name="Position">Starting Position</param> /// <param name="Life">Starting Lifes</param> public Enemy(Skyraha game, Vector2 Position, int speed, float Life = 2f) : base(game, "Enemy", Position, Life) { //assign speed to local speed this.speed = speed; //assign enemy a texture this.Texture = game.Content.Load <Texture2D>("Feind"); }
/// <summary> /// Ship Constructor, for creating Ships and setting the parameters. /// </summary> /// <param name="Name">Name of the new</param> /// <param name="Position">Start Position</param> /// <param name="Life">Ships initial healthpoints</param> public Ship(Skyraha Game, string Name, Vector2 Position, float Life = 3f) : base(Game) { // Announce gameobject to maingame Game.Components.Add(this); // Set initial values this.Name = Name; this.Life = Life; // Load default ship-texture this.Texture = Game.Content.Load <Texture2D>("Jäger"); // Calculate ship position based on texture size this.Position = Position - new Vector2(Texture.Width, Texture.Height) / 2; }
/// <summary> /// Player Constructor /// </summary> /// <param name="game"></param> /// <param name="Position">Starting Position</param> /// <param name="Life">Starting Lifes</param> public Player(Skyraha game, Vector2 Position, float Life = 1.5f) : base(game, "Player", Position, Life) { }
static void Main() { using (var game = new Skyraha()) game.Run(); }