Example #1
0
 public HealthBar(Game1 theGame, ContentManager _content, Rectangle viewPort, Texture2D _sprite)
     : base(theGame, _content, viewPort, _sprite, false, 0.1f)
 {
     healthRect = new Rectangle(0, 30, 100, 10);
     spriteRectangle = healthRect;
     health = 100;
 }
Example #2
0
File: Program.cs Project: Xe3d/Main
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
 //public Explosion explosion;
 public DestructibleGameObject(Game1 _game, ContentManager _content, Rectangle viewPort, Texture2D _sprite, int _health, bool _dieOnExit, bool _respawn, float _layer)
     : base(_game, _content, viewPort, _sprite, _dieOnExit, _layer)
 {
     health = _health;
     fullHealth = health;
     respawn = _respawn;
     //explosion = new Explosion(_game);
 }
Example #4
0
 public Laser(Game1 _game, ContentManager _content, Rectangle viewPort, Texture2D _sprite)
     : base(_game, _content, viewPort, _sprite, false, 1)
 {
     lived = 0;
     destPoint = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
     laserRect = new Rectangle(0, 0, 1, 100);
     laserLength = 0;
     life = 50;
     canFire = true;
     alive = false;
 }
Example #5
0
 public Enemy(Game1 _game, ContentManager _content, Rectangle viewPort, Texture2D _sprite, int _health)
     : base(_game, _content, viewPort, _sprite, _health, true, true, 1)
 {
     delay = game.random.Next(1, ENEMY_DELAY);
     bullets = new GameObject[MAX_ENEMY_BULLETS];
     hasFired = false;
     for (int i = 0; i < MAX_ENEMY_BULLETS; i++)
     {
         bullets[i] = new Bullet(game, game.Content, game.viewportRect, game.Content.Load<Texture2D>("EnemyBullet"), 1);
         game.objectManager.Add(bullets[i]);
     }
     float randPos = game.random.Next(0, 800);
     float randSpeed = game.random.Next(1, 3);
     position = new Vector2(randPos, 10);
     velocity = new Vector2(0, randSpeed);
 }
 //: base(_game)
 public GameObject(Game1 _game, ContentManager _content, Rectangle _viewPort, Texture2D _sprite, bool _dieOnExit, float _layer)
 {
     layer = _layer;
     game = _game;
     sprite = _sprite;
     Rotation = 0.0f;
     position = Vector2.Zero;
     center = new Vector2(sprite.Width / 2, sprite.Height / 2);
     velocity = Vector2.Zero;
     alive = true;
     content = _content;
     viewPort = _viewPort;
     spritebatch = game.SpriteBatch;
     spriteTextureData =
       new Color[sprite.Width * sprite.Height];
     sprite.GetData(spriteTextureData);
     dieOnExit = _dieOnExit;
 }
Example #7
0
 public ship(Game1 _game, ContentManager _content, Rectangle viewPort, Texture2D _sprite, int _health)
     : base(_game, _content, viewPort, _sprite, _health, false, false, 0.2f)
 {
     //this.position = new Vector2(200f,100f);
     //this.velocity = new Vector2(3f, 0f);
     laser = new Laser(game, content, viewPort, content.Load<Texture2D>("pixel"));
     game.objectManager.Add(laser);
     laser.laserColor = Color.Firebrick;
     mainGun = new GameObject(game, content, viewPort, content.Load<Texture2D>("MainGun"), false, 0.3f);
     game.objectManager.Add(mainGun);
     //mainGun.layer = 0;
     bullets = new Bullet[MAX_BULLETS];
     for (int count = 0; count < MAX_BULLETS; count++)
     {
         bullets[count] = new Bullet(game, game.Content, game.viewportRect, game.Content.Load<Texture2D>("Bullet"), 1);
         game.objectManager.Add(bullets[count]);
     }
     position = new Vector2(120, 280);
     //layer = 1;
 }
Example #8
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     Game1 = new Game1();
     Game1.Run();
 }
Example #9
0
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }
Example #10
0
 public Bullet(Game1 theGame, ContentManager _content, Rectangle viewPort, Texture2D _sprite, int _health)
     : base(theGame, _content, viewPort, _sprite, _health, true, false, 1)
 {
     alive = false;
 }
Example #11
0
 public Explosion(Game1 _Game)
 {
     theGame = _Game;
     explosionTexture = theGame.Content.Load<Texture2D>("explosion");
 }