Example #1
0
File: Enemy.cs Project: MyEyes/BGJ5
        void Die(Player p)
        {
            _map.Objects.Remove(this);
            light.Radius = 0;
            Sounds.PlaySound("DeathFlash");
            for (int x = 0; x < 40; x++)
            {
                Vector2 dir = new Vector2((float)(2 * _rand.NextDouble() - 1), (float)(2 * _rand.NextDouble() - 1));
                dir.Normalize();
                dir *= 4.5f + (float)_rand.NextDouble();
                AntiLightParticle alp = new AntiLightParticle(Position, dir, null, _map, null);
                _map.Objects.Add(alp);
            }
            for (int x = 0; x < 20; x++)
            {
                Vector2 dir = new Vector2((float)(2 * _rand.NextDouble() - 1), (float)(2 * _rand.NextDouble() - 1));
                dir.Normalize();
                dir *= 1 + (float)_rand.NextDouble();
                LightParticle alp = new LightParticle(Position, dir, null, Color.White, _map, null);
                _map.Objects.Add(alp);
            }

            LightRefill refill = new LightRefill(Position, _map, null);

            refill.RefillLeft = 150;
            _map.Objects.Add(refill);
        }
Example #2
0
        public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
        {
            this.GraphicsDevice = GraphicsDevice;

            sceneBuffer  = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth16);
            cam          = new Camera(new Vector2(100, 100), GraphicsDevice.Viewport.Bounds);
            map          = new Map(Content);
            map.lightMap = new Lightmap(GraphicsDevice, Content);
            map.lightMap.AmbientColor = new Color(30, 30, 30);

            player = new Player(new Vector2(64, 64), map, Content);
            map.Objects.Add(player);

            Random rand = new Random();

            targetPitch = -1;
            pitch       = -1;

            //Comment this out an uncomment the bit below to test the Win Screen



            for (int x = 0; x < 15; x++)
            {
                int   offset = 30 * Map.TileSize;
                Enemy enemy  = new Enemy(new Vector2(offset + (float)rand.NextDouble() * (Map.SizeX * Map.TileSize - offset), offset + (float)rand.NextDouble() * (Map.SizeY * Map.TileSize - offset)), map, Content);
                map.Objects.Add(enemy);
            }



            /*
             * Enemy enemy = new Enemy(new Vector2(160, 160), map, Content);
             * enemy.Health = 200;
             * map.Objects.Add(enemy);
             * lastEnemy = enemy;
             */



            for (int x = 0; x < 8; x++)
            {
                LightRefill refill = new LightRefill(new Vector2((float)rand.NextDouble() * Map.SizeX * Map.TileSize, (float)rand.NextDouble() * Map.SizeY * Map.TileSize), map, Content);
                map.Objects.Add(refill);
            }

            for (int x = 0; x < 4; x++)
            {
                RageTrigger rt = new RageTrigger(new Vector2((float)rand.NextDouble() * Map.SizeX * Map.TileSize, (float)rand.NextDouble() * Map.SizeY * Map.TileSize), map, Content);
                map.Objects.Add(rt);
            }
            _lastKeyboard = Keyboard.GetState();
        }