Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void AddSmallestEnemy()
- {
- Blob newBlob = new Blob();
- newBlob.texture = blob;
- newBlob.position.X = (float)random.Next(0, 930);
- newBlob.position.Y = (float)random.Next(0, 620);
- newBlob.speed = 1;
- newBlob.scale = 0.1f;
- newBlob.direction = random.Next(1, 4);
- blobList.Add(newBlob);
- }
- public void AddSmallerEnemy()
- {
- Blob newBlob = new Blob();
- newBlob.texture = blob;
- newBlob.position.X = (float)random.Next(0, 930);
- newBlob.position.Y = (float)random.Next(0, 620);
- newBlob.direction = random.Next(1, 4);
- newBlob.speed = 1;
- newBlob.scale = 0.2f;
- blobList.Add(newBlob);
- }
- public void AddMediumEnemy()
- {
- Blob newBlob = new Blob();
- newBlob.texture = blob;
- newBlob.position.X = (float)random.Next(0, 930);
- newBlob.position.Y = (float)random.Next(0, 620);
- newBlob.direction = random.Next(1, 4);
- newBlob.speed = 1;
- newBlob.scale = 0.5f;
- blobList.Add(newBlob);
- }
- public void Update(GameTime gameTime, Rectangle clientBounds)
- {
- foreach (Blob newBlob in blobList)
- {
- switch (newBlob.direction)
- {
- case 1:
- position.X -= speed;
- break;
- case 2:
- position.X += speed;
- break;
- case 3:
- position.Y -= speed;
- break;
- case 4:
- position.Y += speed;
- break;
- }
- if (newBlob.position.X <= 0)
- {
- speed *= -1;
- }
- if (newBlob.position.Y <= 0)
- {
- speed *= -1;
- }
- if (newBlob.position.X > clientBounds.Width)
- {
- speed *= -1;
- }
- if (newBlob.position.Y > clientBounds.Height)
- {
- speed *= -1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement