public Enemy( Texture2D texture, Vector2 location, Rectangle initialFrame, int frameCount) { EnemySprite = new Sprite( location, texture, initialFrame, Vector2.Zero); for (int x = 1; x < frameCount; x++) { EnemySprite.AddFrame( new Rectangle( initialFrame.X = (initialFrame.Width * x), initialFrame.Y, initialFrame.Width, initialFrame.Height)); } previousLocation = location; currentWaypoint = location; EnemySprite.CollisionRadius = enemyRadius; }
public void AddAsteroid() { Sprite newAsteroid = new Sprite( new Vector2(-500, -500), texture, initialFrame, Vector2.Zero); for (int x = 1; x < asteroidFrames; x++) { newAsteroid.AddFrame(new Rectangle( initialFrame.X + (initialFrame.Width * x), initialFrame.Y, initialFrame.Width, initialFrame.Height)); } newAsteroid.Rotation = MathHelper.ToRadians((float)rand.Next(0, 360)); newAsteroid.CollisionRadius = 15; Asteroids.Add(newAsteroid); }
public PlayerManager( Texture2D texture, Rectangle initialFrame, int frameCount, Rectangle screenBounds) { playerSprite = new Sprite( new Vector2(500, 500), texture, initialFrame, Vector2.Zero); PlayerShotManager = new ShotManager( texture, new Rectangle(0, 300, 5, 5), 4, 2, 250f, screenBounds); playerAreaLimit = new Rectangle( 0, 0, screenBounds.Width, screenBounds.Height); for (int x = 1; x < frameCount; x++) { playerSprite.AddFrame( new Rectangle( initialFrame.X + (initialFrame.Width * x), initialFrame.Y, initialFrame.Width, initialFrame.Height)); } playerSprite.CollisionRadius = playerRadius; }
public void FireShot( Vector2 location, Vector2 velocity, bool playerFired) { Sprite thisShot = new Sprite( location, Texture, InitialFrame, velocity); thisShot.Velocity *= shotSpeed; for (int x = 1; x < FrameCount; x++) { thisShot.AddFrame(new Rectangle( InitialFrame.X + (InitialFrame.Width * x), InitialFrame.Y, InitialFrame.Width, InitialFrame.Height)); } thisShot.CollisionRadius = CollosionRadius; Shots.Add(thisShot); }