public override void Initialize() { drawRect = new Microsoft.Xna.Framework.Rectangle(400, 300, 10, 10); this.drawingLocation = new Vector2(400f, 300f); weapon = new Weapon(this.Game, 0, Color.Blue, this.Game.Content.Load<Texture2D>("tmp")); this.Game.Components.Add(weapon); velocity.X = 3; velocity.Y = 3; base.Initialize(); }
public override void Initialize() { drawRect = new Microsoft.Xna.Framework.Rectangle(400, 300, 10, 10); this.drawingLocation = new Vector2(400f, 300f); weapon = new Weapon(this.Game); this.Game.Components.Add(weapon); velocity.X = 3; velocity.Y = 3; this.spriteBatch = new SpriteBatch(Game.GraphicsDevice); this.timer = new GameTimer(this.Game, GameTimer.TimerType.HIT_TIMER, 0); this.timer.Interval = new TimeSpan(50000000); this.Game.Components.Add(timer); this.timer.HTick += new HealthTickHandler(timer_HTick); this.Enabled = false; this.attackable = true; base.Initialize(); }
public Projectile(Game game, Vector2 spawn, float angle, int velocity, int dmg, Weapon.WeaponType type) : base(game) { location = spawn; // origin = new Point((int)Mouse.SLocation.X, (int)Mouse.SLocation.Y); tempVelocity = velocity; wepType = type; this.velocity = new Vector2((float)(tempVelocity * Math.Cos(angle)), (float)(tempVelocity * Math.Sin(angle))); damage = dmg; rotation = angle; MouseState ms = Microsoft.Xna.Framework.Input.Mouse.GetState(); this.location = spawn; if (wepType == Weapon.WeaponType.CATNIP) { this.location = Mouse.SLocation+ new Vector2(ms.X-400, ms.Y-300) + new Vector2(-30, -30); Map.sModList.Add(this); this.range = 150; } else Map.sProjList.Add(this); length = 10; trajLength = 60; }
public void ChangeWeapon(int wepID, Color color, Texture2D texture) { this.weapon = new Weapon(this.Game, wepID, color, texture); }