Exemple #1
0
 public Enemy(Player _p)
 {
     p = _p;
     alive = true;
 }
Exemple #2
0
        public void loadLevel()
        {
            objs = new List<Object>();

            Score.reset();

            StreamReader SR;

            SR = File.OpenText("Content\\level1.txt");
            string S = SR.ReadLine();
            while (S != null)
            {
                string tex = S;
                int x = Int32.Parse(SR.ReadLine());
                int y = Int32.Parse(SR.ReadLine());

                Object o = loadObject(tex);
                o.translate(new Vector2(x, y));

                objs.Add(o);

                S = SR.ReadLine();
            }

            SR.Close();

            //add player
            player = new Player();
            //player.offset = new Vector2(21, 0);
            /*player.addPoint(new Vector2(21, 0));
            player.addPoint(new Vector2(42, 0));
            player.addPoint(new Vector2(64, 21));
            player.addPoint(new Vector2(64, 42));
            player.addPoint(new Vector2(42, 64));
            player.addPoint(new Vector2(21, 64));
            player.addPoint(new Vector2(0, 42));
            player.addPoint(new Vector2(0, 21));*/
            player.addPoint(new Vector2(0, 0));
            player.addPoint(new Vector2(64, 0));
            player.addPoint(new Vector2(64, 54));
            player.addPoint(new Vector2(0, 54));
            player.translate(new Vector2(2800, 2800));
            objs.Add(player);

            player.tex = tex_dict["character"];

            c = new Camera(player, new Vector2(3000, 3000));

            objectCount = objs.Count;

            //make enemies
            for (int i = 0; i < 20; i++) objs.Add(createEnemy(40+r.Next(2900), r.Next(2900), r.Next(10)));
        }
Exemple #3
0
 public Camera(Player _p, Vector2 _bounds)
 {
     p = _p; bounds = _bounds;
 }