public Maid() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; PlayerShip = new Ship(); PlayerShip.AddAccessory(new Vector2(-45, -45), SpaceSprites.gun00()); PlayerShip.AddAccessory(new Vector2(-1 * SpaceSprites.gun00().Width + 1, -79), SpaceSprites.gun00()); PlayerShip.AddAccessory(new Vector2(15, -45), SpaceSprites.gun00()); Input = new InputWrapper(); Boolets = new List<Boolet>(); }
public override void Update(GameTime gameTime, InputWrapper Input) { if (Animating) { if (gameTime.TotalGameTime.Ticks % 3 == 0) { AnimationIndex++; if (AnimationIndex >= AnimationFrames.Count) { Animating = false; AnimationIndex = 0; } } } else { AnimationIndex = 0; } base.Update(gameTime, Input); }
public override void Update(GameTime gameTime, InputWrapper Input) { if (Input.KeyboardSt().IsKeyDown(Keys.Down)) { Velocity -= new Vector2((float)Math.Cos(rotation - (Math.PI / 2)), (float)Math.Sin(rotation - (Math.PI / 2))); Accelerating = true; } if (Input.KeyboardSt().IsKeyDown(Keys.Up)) { // find the component magnitudes for a unit vector pointing in the direction of the rotation Velocity += new Vector2((float)Math.Cos(rotation - (Math.PI / 2)), (float)Math.Sin(rotation - (Math.PI / 2))); Accelerating = true; } else { Accelerating = false; } if (Input.KeyboardSt().IsKeyDown(Keys.Right)) { rotation += 0.1f; } if (Input.KeyboardSt().IsKeyDown(Keys.Left)) { rotation -= 0.1f; } base.Update(gameTime, Input); this.WrapPosition(); for (int i = 0; i < Accessories.Count; i++) { Accessories[i].UpdatePosition(position, rotation); Accessories[i].Update(gameTime, Input); } }
public virtual void Update(GameTime gameTime, InputWrapper Input) { int mills = gameTime.ElapsedGameTime.Milliseconds; position += (Velocity * mills / 1000); }